private void InitGameObject(string gameObjectName) { DeInitGameObject(gameObjectName); _CallbackGameObject = new GameObject(gameObjectName); _CallbackQueue = new AgoraCallbackQueue(); GameObject.DontDestroyOnLoad(_CallbackGameObject); }
private void DeInitGameObject(string gameObjectName) { GameObject gameObject = GameObject.Find(gameObjectName); if (!ReferenceEquals(gameObject, null)) { AgoraCallbackQueue callbackQueue = gameObject.GetComponent <AgoraCallbackQueue>(); if (!ReferenceEquals(callbackQueue, null)) { callbackQueue.ClearQueue(); } GameObject.Destroy(gameObject); gameObject = null; callbackQueue = null; } }