Changing scene layers in game

Hi,

I am trying to start a game from a menu using bge.logic.startGame(blend). However, when the game starts all the scene layers are active no matter how the blend was saved. This causes problems with the add object actuator.

I can’t find any functions referring to layers in the bge docs. How would I solve this?

Thank you,
T_Lazer

It should only start the blend with the currently set layers when you saved the blend file. Make sure that only the layers that you need are toggled. Also, there should be a button with a lock on the 3D scene window header, where the Object (or Mesh), etc. menus are. Check, or un-check that button - it binds the currently active layers / camera to the scene, I think. This can cause some odd results, which sounds like what you’re experiencing.

So it turns out that I the scene layers set up correctly but the objects that were being linked into the scene weren’t. Apparently the startGame function loads linked objects from the layers in their files, rather than the layers they are in on the scene they are linked to.

@SolarLune: Thanks. Neither of those was the problem but the second one is good to know.