TheUninvited
Active Coder
Someone recommended me ,this code which works but only if i put it on update, and i am worried if i put the loop into the update method it will cause performance issues?
When i destroy my cube i want the element to be removed , if i try to add this code into my collision it won't work.
When i destroy my cube i want the element to be removed , if i try to add this code into my collision it won't work.
C#:
if (timesHit >= maxHits)
{
Destroy(gameObject);
for (int i = 0; i < myList.Count; i++)
{
if (myList[i] == null)
{
myList.RemoveAt(i);
i--;
}
}
}