Lights don't work after LibLoad – any ideas?


The fact that light objects get loaded but don’t work as shaders after LibLoading a scene is known. Have you guys figured out any way to go about this?

I’m not going to make every level a scene. They’re separate .blends because the game is big.

The way I’m currently doing this by having a lot of light objects in the startup file, so they get compiled at the start of the Blender Game Engine. For every loaded light form another file I replace it with one of these pre-existing ones. This works, but I have to keep track of every light that is used or not (if the light is deleted, it can be re-loaded from the background layer). This can get ugly with a lot of lights.

Have you guys found any other ways around this issue?

The method you’ve describe is pretty much the way it currently has to be done. However, there’s no reason that your implementation should “get ugly” when dealing with a lot of lights. You should have a fairly simple class that keeps track of all the lights currently in use and all the lights that are available to be added using lists or dictionaries. The number of lights should not affect your code in any way.



If I recall correctly, everything loaded after a light can make use of that light in a shader. In other words, try making sure that your level is the first thing you load, then bring in characters, etc.

Edit: Found the commit I was thinking about: