When intanstiating an object--it is unaffected by lighting and remains dark. Only ambient lighting works.

Hey all!

So my problem deals with instantiating objects into a scene. If I have the ambient light turned on, all instantiated objects are lit when instantiated. I don’t want to use ambient lighting however.

I’m doing a 2d game and using a directional light to emulate the ambient light–but setting it to specific layers so each background layer can be lit darker than the foreground.

So I’m instantiating bullets that are set to their own layer with a directional light that is set to the same layer yet they aren’t lit by the light. If I set another object that isn’t instantiated to that same layer–it is lit by the light when the game starts rendering.

The only solution I’ve found–which doesn’t work actually–is instantiating a light with the instantiated bullet–it works sometimes–and half the time the bullets still aren’t lit or turn off halfway through their lifetime.

So is this a bug in Unity?

Finally!! 2 weeks of dealing with this and I figured it out.

The directional light set to the culling layer that should always be lit(The layer with instantiated bullet objects) needed the “Render Mode” changed from “auto” to “Not Important”. I’m not sure why this is the case–but it works regardless. If someone wants to explain this to me please do!! I hope this helps anyone else with this problem.