상속: UnityEngine.MonoBehaviour
		/// <summary>
		/// This will create a main thread manager if one is not already created
		/// </summary>
		public static void Create()
		{
			if (!ReferenceEquals(Instance, null))
				return;

			Instance = new GameObject("MAIN_THREAD_MANAGER").AddComponent<MainThreadManager>();
			DontDestroyOnLoad(Instance.gameObject);
		}
		// Setup the singleton in the Awake
		private void Awake()
		{
			// If an instance already exists then delete this copy
			if (!ReferenceEquals(Instance, null))
			{
				Destroy(gameObject);
				return;
			}

			// Assign the static reference to this object
			Instance = this;

			// This object should move through scenes
			DontDestroyOnLoad(gameObject);
		}
예제 #3
0
        /// <summary>
        /// This will create the Networker Killer if it hasn't been created already
        /// </summary>
        public static void Create()
        {
            if (!ReferenceEquals(instance, null))
            {
                return;
            }

            if (Threading.ThreadManagement.IsMainThread)
            {
                instance = new GameObject("NetWorker Authority").AddComponent <NetWorkerKiller>();
                DontDestroyOnLoad(instance.gameObject);
            }
            else
            {
                MainThreadManager.Run(() =>
                {
                    instance = new GameObject("NetWorker Authority").AddComponent <NetWorkerKiller>();
                    DontDestroyOnLoad(instance.gameObject);
                });
            }
        }