How do I access the World lighting?

trying this ‘WolrdLighting.environment_energy’ just gives me errors… name not defined.
How can I access it?

EDIT: I dug a bit more, but all I found was this…


but if I assign it to a variable for later use…

someVar = bge.types.KX_WorldInfo.envLightEnergy

I get an uninitated varable error…
‘referenced before assignment’…but it is defined right at the top, before it is called…So, I am assuming this is not correct either.

using UPBGE btw.

The things in bge.types are a little bit special. Typically they are what you have, get or create (eg you have a KX_GameObject, you get it from bge.logic.getCurrentController().owner and you create one using scene.addObject), rather than things that you access.

So the question is where do you get a KX_WorldInfo from? The answer is: your scene.
Try (untested):

import bge
obj = bge.logic.getCurrentController().owner
scene = obj.scene
world_info =
world_info.envLightEnergy = 3.0  # or whatever

scene = bge.logic.getCurrentScene()

world =

world.envLightEnergy = 1.0

ah, ok…I understand…being a semi child of the scene threw me off…that is a bit odd though…will try it, thank you.