FMOD_StudioEventEmitter.OnDestroy C# (CSharp) Метод

OnDestroy() публичный Метод

public OnDestroy ( ) : void
Результат void
    void OnDestroy()
    {
        if (isShuttingDown)
            return;

        FMOD.Studio.UnityUtil.Log("Destroy called");
        if (evt != null && evt.isValid())
        {
            if (getPlaybackState () != FMOD.Studio.PLAYBACK_STATE.STOPPED)
            {
                FMOD.Studio.UnityUtil.Log("Release evt: " + path);
                ERRCHECK (evt.stop(FMOD.Studio.STOP_MODE.IMMEDIATE));
            }

            ERRCHECK(evt.release ());
            evt = null;
        }
    }

Usage Example

Пример #1
0
    public void StartEvent(string key, AudioChannel channel = AudioChannel.Action, bool stopPre = true, string para = "", float value = 0f)
    {
        FMOD_StudioEventEmitter emitter = this.GetEmitter(channel);

        if (stopPre)
        {
            emitter.OnDestroy();
        }
        if (!string.IsNullOrEmpty(key))
        {
            emitter.path = key;
        }
        emitter.CacheEventInstance();
        this.SetParamValue(channel, para, value);
        if (this._3dPos != Vector3.zero)
        {
            emitter.Update3DAttributes(this._3dPos);
            this._3dPos = Vector3.zero;
        }
        emitter.StartEvent();
    }