Language

C# GameObject Lists

Hi im using a list in C# to list all of my game objects in unity so that i can select them, but when i destroy those game objects im not able to select the rest of the objects because the gameobect was destroyed. can anyone help me?

You might need to reupdate you list because once you destroy an object, the list pointer points to null.,You might need to reupdate your list so that the pointer to the destroyed object is overwritten. I think your problem is with a null pointer.

@Marnix: Yes and no ;) The C# part of components remain but it can't be used anymore. Also a check against null will be positive since they overloaded UnityEngine.Objects equally and inequally operators.

Your answer

Hint: You can notify a user about this post by typing @username

Attachments:
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.