hi! I wanted to ask a question. How can I check if an instance of the object is deleted? I mean every time an instance is removed to an event occurring (score, sound, etc. …) what can you do?
Is this one instance at a time or multiple? For a single instance, you should be able to set up a GameObject variable and use it on creation:
GameObject sound = null;
// In function
sound = Instantiate(etc...);
if(sound == null)
{
// It's been destroyed
}
Course that’s untested pseudo-code, but you get the idea. Before it’s destroyed, it will have a reference to the object. Once the object’s destroyed, the variable will be null again.
If you need multiple objects, you might need to use a List (“using System.Collections.Generic;” will need to be added to the top of a C# script to include it). On that one you’d just iterate over it to find the deleted one. If you can provide more specific information, you’ll typically get more specific answers ![]()