Game initialisation

When a new scene is loaded or restarted, what is the best method of running an initialisation script?

I’ve seen it done using the camera, but I have a single camera linked throughout, so it’d want to be scene dependent.

  • Bear with me, i’m new to BGE… Thanks!

Always sensor?

Yes, like LaH said, use an Always sensor with no pulse settings (neither [’’’] button is ticked). That will run the script once on scene initialization. It will also run on each new scene EDIT: that the camera is in. :wink:

I’ve added an non-pulsing Always to the camera, then linked it to a script so that it can figure out what to do…

I was wondering if you could add one to an actual scene.

If not i’ll add a random hidden cube (empty) and add the same to that instead. Just thought i’d find out the general method used…

Thanks!

“Add one” what? People do different things - for game initialization, I usually use an invisible cube floating in mid-air conspicuously somewhere. The camera could also initialize things as well - it’s up to you.