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"){
audio.PlayOneShot(mySound);
Destroy(myPrefab);
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?