How can I Build lighting from code?

Hi,

I would like to know how can I build the lighting from the code ?
I have a cube (in the editor) which is copied to random locations into the world (in C++), and so the lighting needs to be rebuilt after the cubes were placed…

Thanks!

This show how to make an light and light switch using only C++ :
https://docs.unrealengine.com/latest/INT/Programming/Basics/ClassCreation/CodeOnly/index.html

This should get you started.

Thanks for your answer hbrock, but that’s not what I’m trying to do… The lighting is already made in the scene, I just want UE to rebuild it after my map is randomly created (because actually, the light is not really good…).

Hi valx76. Are your cubes dynamic objects? If they are not, try changing the Mobility property to Movable. They don’t have to actually move during the game, but changing the Mobility property to Movable will allow them to dynamically accept lighting from the scene and cast shadows, so the lighting does not have to be rebuilt every time you run the game.

Hi , thanks for your answer, I think that’s doing the job :slight_smile: !