When removing something from a list it says missing

I have a list that I using to store the current buildings in a units sight for an RTS game. Whenever that building is destroyed it just says missing inside the list where it was inside the list. I’m wondering how to reduce the list so that it doesn’t say missing and the size of the list will go down one when the building is destroyed. Thank you and please let me know if you need more information 87531-sightlistproblem.png

There is a method to resize an array in System.Array called Resize(ref array, int newSize), but the bad thing is, in your example, if you were to resize the array, HQ would disappear from the array, so you’d have to figure out a way to calculate the number of objects inside of an array, that are not missing, moving them to the start of an array and then resizing to the number of objects that are not missing in the array.

Instead, I would suggest using a list. The way you declare it is:

List<T> yourList = new List<T>(); where T is the type of the object that you want to use. Then it’s as simple as just calling Add() or Remove() on it, for specific objects.