Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

permanently deleting elements in List<> on inspector

Discussion in 'Scripting' started by JACKO4590, Jul 26, 2017.

  1. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    81
    Hey guys.
    I have a spawn script with a custom editor button attached to it.
    When i press the button it spawns a game object. Now what i want is when it is deleted out of play mode i want to remove it for the list<> as well.

    So far i have
    spawnLocations.RemoveAll(list_item => list_item == null);
    but leaving playmode will put these back into the list.

    Cant find much on permanently deleting the elements.
    Thanks.