public void Play() { if (!FmodEvent.IsPlaying(musicInstance)) { musicInstance = FmodEvent.Play(music, gameObject.transform, null); } }
private void OnEnable() { listenerGameObject = FindObjectOfType <StudioListener>(); if (listenerGameObject != null) { m_targetTransform = listenerGameObject.transform; } else { Debug.LogError(this + ": No GameObject with 'Studio Listener' Component found! Aborting."); enabled = false; } _instance = FmodEvent.Play(eventToPlay, m_eventEmitter.transform, null); positionClamperRoutine = ClampEmitterPosition(); StartCoroutine(positionClamperRoutine); }