Hi,
I have a script that I play an sfx and then destroy the object:
AudioSource.PlayClipAtPoint (PickupSFX, transform.position);
Destroy (gameObject);
but if I change order of them, I can still hear the sfx! I thought a Destroy() call would destroy the object instantly, but apparently it isn’t the case. Am I missing something?
Thanks.
However, you should never destroy it with a DestroyImmediate() function in the game, it can (roughly speaking) break the Unity Update pattern as it's iterating over the set of active objects. You should instead disable all playing SFX through your code by calling all of your audio.Stop methods and stuff
– Kumo-Kairo