UnityEngine.Networking.NetworkIdentity.Reset C# (CSharp) Method

Reset() private method

private Reset ( ) : void
return void
        internal void Reset()
        {
            this.m_IsServer = false;
            this.m_IsClient = false;
            this.m_HasAuthority = false;
            this.m_NetId = NetworkInstanceId.Zero;
            this.m_IsLocalPlayer = false;
            this.m_ConnectionToServer = null;
            this.m_ConnectionToClient = null;
            this.m_PlayerId = -1;
            this.m_NetworkBehaviours = null;
            this.ClearObservers();
            this.m_ClientAuthorityOwner = null;
        }

Usage Example

        static void OnSpawnSceneObject(NetworkMessage netMsg)
        {
            SpawnSceneObjectMessage msg = new SpawnSceneObjectMessage();

            netMsg.ReadMessage(msg);

            if (LogFilter.logDebug)
            {
                Debug.Log("Client spawn scene handler instantiating [netId:" + msg.netId + " sceneId:" + msg.sceneId + " pos:" + msg.position);
            }


#if UNITY_EDITOR
            UnityEditor.NetworkDetailStats.IncrementStat(
                UnityEditor.NetworkDetailStats.NetworkDirection.Incoming,
                (short)MsgType.SpawnSceneObject, "sceneId", 1);
#endif

            NetworkIdentity localNetworkIdentity;
            if (s_NetworkScene.GetNetworkIdentity(msg.netId, out localNetworkIdentity))
            {
                // this object already exists (was in the scene)
                localNetworkIdentity.Reset();
                ApplySpawnPayload(localNetworkIdentity, msg.position, msg.payload, msg.netId, localNetworkIdentity.gameObject);
                return;
            }

            NetworkIdentity spawnedId = SpawnSceneObject(msg.sceneId);
            if (spawnedId == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("Spawn scene object not found for " + msg.sceneId + " SpawnableObjects.Count=" + s_SpawnableObjects.Count);
                    // dump the whole spawnable objects dict for easier debugging
                    foreach (var kvp in s_SpawnableObjects)
                    {
                        Debug.Log("Spawnable: SceneId=" + kvp.Key + " name=" + kvp.Value.name);
                    }
                }
                return;
            }

            if (LogFilter.logDebug)
            {
                Debug.Log("Client spawn for [netId:" + msg.netId + "] [sceneId:" + msg.sceneId + "] obj:" + spawnedId.gameObject.name);
            }
            spawnedId.Reset();
            ApplySpawnPayload(spawnedId, msg.position, msg.payload, msg.netId, spawnedId.gameObject);
        }
All Usage Examples Of UnityEngine.Networking.NetworkIdentity::Reset