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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. 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.