pokepetter / ursina

A game engine powered by python and panda3d.
https://pokepetter.github.io/ursina/
MIT License
2.22k stars 326 forks source link

NameError: name 'render' is not defined #239

Closed mavdotjs closed 3 years ago

mavdotjs commented 3 years ago

Full Error

Traceback (most recent call last):
  File "c:\Users\RedRa\Documents\vscode\untitled-game\main.py", line 23, in 
<module>
    quitbutton = Button(text='Quit', color=color.azure)
  File "C:\Users\RedRa\AppData\Roaming\Python\Python39\site-packages\ursina\prefabs\button.py", line 26, in __init__
    self.model = Quad(aspect=self.scale[0] / self.scale[1])
  File "C:\Users\RedRa\AppData\Roaming\Python\Python39\site-packages\ursina\models\procedural\quad.py", line 11, in Quad
    return QuadMesh(radius, segments, aspect, scale, mode, thickness)       
  File "C:\Users\RedRa\AppData\Roaming\Python\Python39\site-packages\ursina\models\procedural\quad.py", line 42, in __init__
    new_verts.append(QuadMesh.point_placer.world_position)
  File "C:\Users\RedRa\AppData\Roaming\Python\Python39\site-packages\ursina\entity.py", line 410, in world_position
    return Vec3(self.get_position(render))
NameError: name 'render' is not defined

How do i fix this error? i am following the minecraft tutorial and wanted a menu but it says a variable isnt defined inside ursina code

mavdotjs commented 3 years ago

Ok, i checked https://github.com/pokepetter/ursina/blob/31cb718a1aac635ebc996e87f1ff3b688f793633/ursina/entity.py#L410 and i dont see any reference of a variable called 'render', was it meant to be a parameter?

mavdotjs commented 3 years ago

A snippet of my code:

quitbutton = Button(text='Quit', color=color.azure)
quitbutton.on_click = quit
wp = WindowPanel(
    title='Menu',
    content=(
        quitbutton,
        Slider(),
        Slider(),
        ),
        popup=True,
        enabled=False
    )
def input(key):
    if key == 'escape':
        wp.enabled = True
pokepetter commented 3 years ago

You need to create an instance of Ursina first.

mavdotjs commented 3 years ago

i already did

pokepetter commented 3 years ago

no