Answer the question
In order to leave comments, you need to log in
How to remove the void from the sheet, left after the destruction of the objects included in it?
There are objects in a sheet called Group.
public List<GameObject> Group = new List<GameObject>();
Destroy(gameObject);
controller.Group.Remove(gameObject);
Destroy(gameObject);
Answer the question
In order to leave comments, you need to log in
Let's try to explain what's wrong.
foreach (GameObject tmp in Group)
{
}
for(int i =0; i <list.Count;i++)
{
Destroy(list[i]);
list.RemoveAt(i);
i--; // сместили индекс,если было удаление, так как размер коллекции уменьшился
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question