Passing information between scenes

How do I pass information between scenes, either where I use setScene() or where the scene is an overlay?



Two ways I know of:

  1. The simplest way is to have an ‘always’ sensoron an object in your new scene that activates a copy property actuator.

Set the ‘copy property’ actuator so that it copies info from the properties on your old object in the old scene.

Every time you go into your new scene it will copy once from your old scene (so long as you deactivate your ‘True/False pulse modes’ buttons). If you’re using an overlay scene and you wnat the new object to update its property info every frame then press the ‘True pulse mode’ button on the ‘always’ sensor.

  1. Use save and load scripts between scene - more flexibility but more tricky to do.

You can store information inside the GameLogic object, which can be read by all python scripts in all scenes. For example:

c = GameLogic.getCurrentController()
ownr = c.getOwner()

GameLogic.prop = ownr.prop

I suggest you search through the previous posts in the forum in future.

Keith. 8)

Thanks for the info. I will look more thoroughly next time.