public static void Out(AudioSource source, float fadeTime) { #if UNITASK OutInternal(source, fadeTime).Forget(); #elif EDITOR_COROUTINES && UNITY_EDITOR if (!Application.isPlaying) { EditorCoroutineUtility.StartCoroutineOwnerless(OutInternal(source, fadeTime)); } else { CoroutineRunner.RunCoroutine(OutInternal(source, fadeTime)); } #else CoroutineRunner.RunCoroutine(OutInternal(source, fadeTime)); #endif }
public static void In(AudioSource source, float volume, float fadeTime, float delay) { #if UNITASK InInternal(source, volume, fadeTime, delay).Forget(); #else #if EDITOR_COROUTINES && UNITY_EDITOR if (Application.isPlaying) { CoroutineRunner.RunCoroutine(InInternal(source, volume, fadeTime, delay)); } else { EditorCoroutineUtility.StartCoroutineOwnerless(InInternal(source, volume, fadeTime, delay)); } #else CoroutineRunner.RunCoroutine(InInternal(source, volume, fadeTime, delay)); #endif #endif }
private static void StopAfter(AudioHandle handle, float time) { // Select despawn strategy based on what packages are present #if UNITASK StopAfterInternal(handle, time).Forget(); #else #if EDITOR_COROUTINES && UNITY_EDITOR if (Application.isPlaying) { CoroutineRunner.RunCoroutine(StopAfterInternal(handle, time)); } else { EditorCoroutineUtility.StartCoroutineOwnerless(StopAfterInternal(handle, time)); } #else CoroutineRunner.RunCoroutine(StopAfterInternal(handle, time)); #endif #endif }