Why is an Instance of Prefab not being Destroyed?

Hey guys,

Not really sure what I’m doing wrong here. I have a prefab with some sounds and colliders on it. Everything works fine when I walk into it.

This prefab needs to be used several times.

When I walk into the first prefab, everything works great and goes as planned.

However, when I walk into the second prefab, everything works great. All the sounds play, etc, but for whatever reason the prefab does not get destroyed.

It just stays there, like nothing happened. I can continue to walk into the colliders and all the sounds will play, etc, but the prefab never gets destroyed?

What am I doing wrong and how do I fix this?

Here’s my code:

     if (myTrigger.tag == "theTrigger"){
           print("prefab destroyed");

Any ideas?

Thanks in advance!

*Edit to add print("prefab Destroyed");
and prefab destroyed shows up so we know that Destroy(myPrefab); was called.

** Edit Why isn’t an instance of a prefab being destroyed?

You should destroy the GameObject instance in the scene, not the prefab.

Finally figured it out. I used:


Instead of:


Although, I’m still not clear on why you can’t use Destroy(myPrefab); (which is an instance of a prefab, not the actual prefab).

Thanks for all who tried to help.