• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by SimplyNew · Nov 02, 2020 at 10:04 AM · 2dlightingrenderinguniversal

URP 2D lights not working as expected

Hi,

I am facing a weird issue with 2D lights. Lights are not correctly applied. And another issue is: even if I dont apply light to a layer, all layers are still lit.

Please, see below screenshots. Its a sample scene with only 3 sprites each in different sorting layers in sequence (Background, Middleground, Default). Scene has only one Global Light. When I set target sorting layers to none, light gets applied to all layers. Only when I disable the light from inspector all sprites turn black. Ideally, none target sorting layers should also turn my scene black. Another issue is: when I set specific layer, it doesnt apply to that particular layer. This is just an example of Global Light. Point and Parametric light behaves the same way.

I have also put all sprites in different z position to be sure.

URP Version: 8.2.0

Unity Version: 2020.1.2f1

Material Used for all sprites: Universal Render Pipeline/2d/Sprite-Lit-Default alt text
alt text

Any help would be appreciated.

step4.jpg (155.9 kB)
step1.jpg (115.9 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image sicienss · Nov 03, 2021 at 11:35 AM 0
Share

I also ran into this issue. As of 11/2/2021, none of the below answers solve the issue.

I asked about it on Game Dev Stack Exchange, as well as in Unity dev discord. No answer yet. For reference, my write up is at https://gamedev.stackexchange.com/questions/197676/lights-do-not-fully-respect-sortinglayers-in-universal-render-pipeline

6 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by justincredibleg · Nov 02, 2020 at 03:49 PM

Are you sure you're using the URP/2d/Sprite shader on all of the actual sprite objects? Within your sprite renderer are you setting the sorting layer there? The Layer up at the top of the editor isn't what you're targeting with the light.

Is there a reason you're using 2020 instead of 2019.4? Unless there is a specific feature you need in 2020 I'd recommend using a LTS version of 2019.4.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SimplyNew · Nov 05, 2020 at 05:01 AM 0
Share

Thanks for reply. I am certain that I am using correct sorting layers. Not layers. Please, see below screenshot of background layer sprite. That screenshot also shows the material and shader.

While playing around this, I also found that if I add another Parametric light just sake of keeping it. Everything started working. So, it's not like URP and lighting are not working at all.

I am not looking for any specific feature in 2020. But, since I just started out project and 2020 will likely be LTS by next year spring, I thought let's start with latest. I think my project will go beyond 2021 December for sure.

Before I hit this snag, I didnt have any issues. $$anonymous$$oreover, I am not using any major preview version packages to be on safer side. But, I will certainly keep your suggestion in $$anonymous$$d and decided sooner.

alt text

spritescreenshot.jpg (149.5 kB)
avatar image
1

Answer by SimplyNew · Nov 21, 2020 at 01:41 AM

Update:
I tried with different URP versions and looks like this works fine till 7.3.1. Post 7.3.1 all versions have this issue.

Do anyone else has similar issue? I have reverted URP version to 7.3.1 for now.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by MilkIsTheBest · Jan 30, 2021 at 11:04 AM

Think I got a solution. What I did is to keep the light with the target sorting layer, add a global light, set the new global lights color too black, and change target sorting layer of the new global light to all. Hope it works for all of you.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by FireFoundry01 · Apr 26, 2021 at 02:36 AM

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by hemantchauhan07 · Oct 21, 2021 at 04:49 PM

Here is the best answer and updated.

Follow the link

https://www.youtube.com/watch?v=ydj1R5Jd0L0

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

308 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Extrange Behaviour with 2D Lights in Universal RP 0 Answers

Universal Render Pipeline use 2D and 3D lights at the same time 0 Answers

Sorting layer ignores 2d lights from the 2d renderer 0 Answers

How to make a 2D sprite 'reflect more light' in URP 2D? 0 Answers

Modify 2D Point Light Distance in runtime? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges