- Home /
How to Play 3D Sound and Keep Script on Multiple Prefabs after Destroying a gameObject?
Hey everybody,
I have a prefab with 3, 3D Sound on them. The sounds are played when onTriggerEnter is called. The gameObject is then destroyed.
The problem is I have the script and the sounds to play attached to the gameObject, that is destroyed.
So, if I use this as a prefab, it doesn't work because that script has been destroyed. The next time I go to collect the next prefab with the 3D sound, it obviously won't work. Because the sounds and the script have been destroyed.
If this was a 2D Sound I could just have on gameObject with the script and sounds on that, and problem solved.
But, in this scenario, I am using 3D Sounds and I need the sounds to be placed and played where the gameObject is.
How do I get around using a 3D Sound on a prefab, without destroying the scripts or the sounds and still have the sounds come from where the prefab is located?
I think I am missing something really obvious here, but I haven't come across this situation before.
Any help is really appreciated.
Thank in advance!