private static void InstantiateAndPlaySoundEffectInstance(LimitedInstancingSoundEffectBehaviour effectPrefab, int index) { LimitedInstancingSoundEffectBehaviour behaviour = Instantiate <LimitedInstancingSoundEffectBehaviour>(effectPrefab); DontDestroyOnLoad(behaviour.gameObject); behaviour.Play(index); }
protected static bool CreateSoundEffectInstance(LimitedInstancingSoundEffectBehaviour effectPrefab, int index, float minTimeForPlayingSec) { if (!CanInstantiateSoundEffect(index, minTimeForPlayingSec)) { return(false); } InstantiateAndPlaySoundEffectInstance(effectPrefab, index); return(true); }