Unity 2D Lighting From Universal Render Pipeline Not Working
I followed two tutorials (circa 2019, if anything has changed since then) to get lighting working for my 2D game. Using version 2021.1.4f1
After following their instructions it seemed like for whatever reason only my particle layer was "affected" by lighting, I say effected because they turned pitch black while everything else remained the same. I had initially followed the instructions to go to Edit -> Universal Render Pipeline -> Upgrade to Universal RP Materials, but that didn't do anything- after I went through again and selected "Upgrade to 2D Renderer", all of my sprites (sans for the background) are pitch black but no lighting will change anything.
I have also tried:
Going to Quality in the project settings and setting Rendering to UniversalRenderPipelineAsset
Deleting the Initially created UniversalRenderPipelineAsset_Renderer, and adding the new 2D Renderer Data and setting it to the Renderer
Changing the sprite renderer's materials- the ones initially turning pitch black were set to Sprites-Lit-Default (though were still unaffected by lights), and the ones that were staying the same were set to Sprites-Default. Changing the ones set to Sprites-Default to Sprite-Lit-Default or SpriteLit (which are apparently two different materials) did not work. They're currently set to Sprite-Lit-Default. If it's set to Sprite-Lit-Default they're fully lit but unaffected by lighting.
Changing layers all the sprites were on
Changing z axis of the lights
Closing and reloading Unity
Fiddling with settings on the lighting objects
Disabling my Cinemachine Camera and Main Camera
Settings I have below/attached. I have two lights, one of which is global and one is a point light, both with default settings. Objects are pitch black in both the game and scene tabs.
Sprite settings, when I turn the head to Sprite-Lit-Default it becomes fully lit but is unaffected by lighting.
Noticing that setting the layer to default (it's currently set to humanoid for most of my objects) makes them visible but, again, unaffected by lighting. So for some reason EITHER setting the sorting layer to "Default" or setting the material to Sprite-Unlit-Default can make them visible again but still unaffected by lighting.
Doing some fiddling around some more I did something where I got one of my sprites into a mode where I could only select between "SpriteLit" and "Sprites-Default", as opposed to the other mode where I could select "Sprite-Lit-Default" and "Sprite-Unlit-Default". Not sure what lets that happen, this is all very confusing.
Answer by Newfa_Games · Jun 24, 2021 at 10:26 PM
Figured it out. I had to have the light apply to all layers and I had to modify the sorting layers of the sprites, and I need to have them all set to Sprite-Lit-Default.
Your answer
Follow this Question
Related Questions
Tilemap tiles always lit up. 0 Answers
Unity 2D Lighting 0 Answers
can i create 2d light and darkness in unity ?? 1 Answer
Lighting question 0 Answers