I try to run a simple python invisible visible toggling python controller module. This works well inside blender, but not in the generated game engine runtime.
- a 'Cube' mesh
- a keyboard sensor named 'VisibilityKey' with 'All Keys' selected
- a python controller in 'Module' mode with source 'mybpylib.visibilitytoggle'
- controller and sensor are linked.
In the mybpylib.py file i have the following code:
def visibilitytoggle(o_ctrlr): if (o_ctrlr.sensors["VisibilityKey"].positive): for _ in o_ctrlr.sensors["VisibilityKey"].events: if (o_ctrlr.owner.visible == True): o_ctrlr.owner.visible = False print("i was visible") else: o_ctrlr.owner.visible = True print("i was invisible")
When I inside blender game engine press 'P' the invisible visibile toggling of the cube woks perfectly by pressing any key.
When I 'File / Save As Game Engine Runtime' the game get saved, but when I start the executable the invisible visible toggling does not work.
I am using:
- Blender version 2.78c (and corresponding blenderplayer)
- on MacOS X 10.12.5 (sierra)
I am still quit a blender noob. It might be that I miss something simple but I can not figure out what. Any help is appreciated.