Exemplo n.º 1
0
        //public static void EnsureNSTMasterExistsInScene()
        //{
        //	if (NSTMaster.Single == null)
        //		NSTMaster.EnsureExistsInScene(NSTMaster.DEFAULT_GO_NAME);
        //}

#if UNITY_EDITOR
        /// <summary>
        /// Ensures NSTSettings as well as (NSTMaster/MasterAdapter/NetworkIdentity) exist in the scene.
        /// </summary>
        /// <returns></returns>
        public static void EnsureSceneNetLibDependencies(bool immediate = true)
        {
            if (Application.isPlaying)
            {
                return;
            }

            // If a post-recompile rebuild of dependencies is pending... do it now.
            TryToAddDependenciesEverywhere();

#if MIRROR || !UNITY_2019_1_OR_NEWER
            if (MasterNetAdapter.NetLib == NetworkLibrary.UNET)
            {
                GetNetworkManager(true);
                CopyPlayerPrefab();
            }
#endif

            //if (NetLibrarySettings.Single.AutoAddNSTMaster)
            //	NSTMaster.EnsureExistsInScene(NSTMaster.DEFAULT_GO_NAME);
            if (NetLibrarySettings.Single.AutoAddSettings)
            {
                NSTSettings.EnsureExistsInScene(NSTSettings.DEFAULT_GO_NAME);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Ensures NSTSettings as well as (NSTMaster/MasterAdapter/NetworkIdentity) exist in the scene.
        /// </summary>
        /// <returns></returns>
        public static void EnsureSceneNetLibDependencies(bool immediate = true)
        {
            if (Application.isPlaying)
            {
                return;
            }

            NSTSettings.EnsureExistsInScene();

            // If a post-recompile rebuild of dependencies is pending... do it now.
            TryToAddDependenciesEverywhere();

            if (MasterNetAdapter.NetLib == NetworkLibrary.UNET)
            {
                GetNetworkManager(true);
                CopyPlayerPrefab();
            }

            NSTMaster.EnsureExistsInScene(NSTMaster.DEFAULT_GO_NAME);
            NSTSettings.EnsureExistsInScene(NSTSettings.DEFAULT_GO_NAME);
        }