/// <summary> /// Play a sound attached to this game Object. If you set a tag for a soundclip, it will be parented /// to a GameObject and that object can be passed in to play the sound. /// </summary> /// <param name="obj"></param> public static void PlaySound(GameObject obj) { SoundClip clip = obj.GetComponent <SoundClip>(); if (clip == null) { clip = obj.GetComponentInChildren <SoundClip>(); if (clip != null) { PlaySound(clip.Sound); } else { L.Log(LogEventType.ERROR, $"No audioSource component found on {obj.name}"); } } }