Search Unity

Question Can't remove Light because HDAdditionalLightData (Script) depends on it

Discussion in 'High Definition Render Pipeline' started by davidwhiffen, Mar 10, 2021.

  1. davidwhiffen

    davidwhiffen

    Joined:
    Sep 26, 2019
    Posts:
    14
    Hey guys,

    I'm working on a game where characters shrink and grow in size, and each time they do, an effect spawns with a light on it.

    Every time the effect spawns, I get a console error,
    "Can't remove Light because HDAdditionalLightData (Script) depends on it"

    https://imgur.com/a/8GaU9Zn

    So how do I get around this message?

    I can obviously not destroy the effect, but then there will be hundreds of them in the scene.


    The effect is being removed from the heirarchy, so it is getting destroyed, I just don't want to see these errors hundreds of times over.
     
    maxximme and MostHated like this.
  2. maxximme

    maxximme

    Joined:
    Aug 18, 2021
    Posts:
    12
    Last edited: Jul 8, 2022
  3. abandon_games

    abandon_games

    Joined:
    Sep 1, 2017
    Posts:
    38
    I was getting this error because I was destroying the `Light` component instead of the game object that the `Light` component is attached to - seems like the proper way to get rid of the light data is to destroy the game object itself.
     
    Gasimo likes this.