UnityEngine.Networking.NetworkManager.FinishLoadScene C# (CSharp) Method

FinishLoadScene() private method

private FinishLoadScene ( ) : void
return void
        private void FinishLoadScene()
        {
            if (this.client != null)
            {
                if (s_ClientReadyConnection != null)
                {
                    this.m_ClientLoadedScene = true;
                    this.OnClientConnect(s_ClientReadyConnection);
                    s_ClientReadyConnection = null;
                }
            }
            else if (LogFilter.logDev)
            {
                Debug.Log("FinishLoadScene client is null");
            }
            if (NetworkServer.active)
            {
                NetworkServer.SpawnObjects();
                this.OnServerSceneChanged(networkSceneName);
            }
            if (this.IsClientConnected() && (this.client != null))
            {
                this.RegisterClientMessages(this.client);
                this.OnClientSceneChanged(this.client.connection);
            }
        }

Usage Example

コード例 #1
0
        internal static void UpdateScene()
        {
#if UNITY_EDITOR
            // In the editor, reloading scripts in play mode causes a Mono Domain Reload.
            // This gets the transport layer (C++) and HLAPI (C#) out of sync.
            // This check below detects that problem and shuts down the transport layer to bring both systems back in sync.
            if (singleton == null && s_PendingSingleton != null && s_DomainReload)
            {
                if (LogFilter.logWarn)
                {
                    Debug.LogWarning("NetworkManager detected a script reload in the editor. This has caused the network to be shut down.");
                }

                s_DomainReload = false;
                s_PendingSingleton.InitializeSingleton();

                // destroy network objects
                var uvs = FindObjectsOfType <NetworkIdentity>();
                foreach (var uv in uvs)
                {
                    GameObject.Destroy(uv.gameObject);
                }

                singleton.StopHost();

                NetworkTransport.Shutdown();
            }
#endif

            if (singleton == null)
            {
                return;
            }

            if (s_LoadingSceneAsync == null)
            {
                return;
            }

            if (!s_LoadingSceneAsync.isDone)
            {
                return;
            }

            if (LogFilter.logDebug)
            {
                Debug.Log("ClientChangeScene done readyCon:" + s_ClientReadyConnection);
            }
            singleton.FinishLoadScene();
            s_LoadingSceneAsync.allowSceneActivation = true;
            s_LoadingSceneAsync = null;
        }
All Usage Examples Of UnityEngine.Networking.NetworkManager::FinishLoadScene