This class is responsible for doing any late cleanup of threads and networked objects
Inheritance: UnityEngine.MonoBehaviour
        /// <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 !UNITY_WEBGL
            if (Threading.ThreadManagement.IsMainThread)
            {
#endif
            instance = new GameObject("NetWorker Authority").AddComponent <NetWorkerKiller>();
            DontDestroyOnLoad(instance.gameObject);
#if !UNITY_WEBGL
        }

        else
        {
            MainThreadManager.Run(() =>
            {
                instance = new GameObject("NetWorker Authority").AddComponent <NetWorkerKiller>();
                DontDestroyOnLoad(instance.gameObject);
            });
        }
#endif
        }
示例#2
0
        /// <summary>
        /// Clean all the sockets and connections
        /// </summary>
        private void OnApplicationQuit()
        {
            if (NetWorkers == null || NetWorkers.Count == 0)
            {
                return;
            }

            Networking.Disconnect();

            UnityEventObject.Cleanup();
            Threading.Task.KillAll();

            NetWorkers.Clear();
            NetWorkers = null;
            instance   = null;
        }
		/// <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);
				});
			}
		}
		/// <summary>
		/// Clean all the sockets and connections
		/// </summary>
		private void OnApplicationQuit()
		{
			if (NetWorkers == null || NetWorkers.Count == 0)
				return;

			Networking.Disconnect();

			UnityEventObject.Cleanup();
			Threading.Task.KillAll();

			NetWorkers.Clear();
			NetWorkers = null;
			instance = null;
		}
示例#5
0
        /// <summary>
        /// This will create the Networker Killer if it hasn't been created already
        /// </summary>
        public static void Create()
        {
            if (instance != null)
                return;

            instance = new GameObject("NetWorker Authority").AddComponent<NetWorkerKiller>();
            DontDestroyOnLoad(instance.gameObject);
        }