Hey there,
i'm trying to delete an audioSource (CargoPlane) but i got a convert exception:
Argument #1 cannot convert to expression to type UnityEngine.Object
var sound = p.GetComponent<AudioSource>();
if(sound != null)
{
UnityEngine.Object.DestroyImmediate(sound);
}I've tested it with UnityEngine.AudioSource.DestroyImmediate() but it ends in a `.` operator cannot be applied to operand of type UnityEngine.AudioSource.
What i want is simple: Removing the CargoPlane Engine sound. Removing the CargoPlane Component doesn't stop the sound.
Any ideas?
Thanks :)