public static void Play(AudioClip clip) { UIAudioPlayer instance = UIAudioPlayer.Instance; if (instance != null && instance.CanPlaySound()) { AudioSource source = UIAudioPlayer.Instance.GetSource(); if (source == null) { return; } source.PlayOneShot(clip); } }
public static void Play(UIAudioPlayer.UISoundType type) { if (type >= UIAudioPlayer.UISoundType._Count) { return; } UIAudioPlayer instance = UIAudioPlayer.Instance; if (instance != null && instance.CanPlaySound()) { AudioClip audioClip = UIAudioPlayer.Instance.m_StandardSounds[(int)type]; if (audioClip != null) { AudioSource source = UIAudioPlayer.Instance.GetSource(); if (source == null) { return; } source.PlayOneShot(audioClip); } } }