I’ve got a text object that should change multiple times using modules. So for example:
import bge scene = bge.logic.getCurrentScene() dynamicText = scene.objects["Text"] #print(dir(dynamicText)) def walk(): dynamicText.text = "you can walk" def jump(): dynamicText.text = "you can jump"
The first function runs without any problem, but when the second function is called by a sensor the text doesn’t change and i get the following error in my console:
Python script error - object 'HUDcontroller', controller 'Python1': Traceback (most recent call last): File "…", line 14, in jump SystemError: Blender Game Engine data has been freed, cannot use this python variable
Is it even possible to change a text multiple times? What am I doing wrong here?
PS: Is there any documentation about it? I can’t find any