Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Light2D instantiated at runtime not lighting anything

Discussion in 'Universal Render Pipeline' started by Weaver, Mar 2, 2023.

  1. Weaver

    Weaver

    Joined:
    Jul 2, 2013
    Posts:
    18
    I'm working on a 2D scene using lit sprites - any Light2D objects into the scene at launch render fine. However I'm trying to add a Light2D (a spotlight to be specific) programmatically and it doesn't light anything.

    The setup is very simple to reproduce - just make a prefab that has a Light2D Spotlight on it and then instantiate it via a script and it will not light any lit sprites.

    Using Unity 2021.3.19f1
    URP 12.1.0

    Any advice is appreciated! I feel stuck.
     
  2. Weaver

    Weaver

    Joined:
    Jul 2, 2013
    Posts:
    18
    Got it I'm just a dummy - I was rotating the game object incorrectly which caused the light to go crazy - was basically looking at the backface of it.