Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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:
    16
    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:
    16
    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.