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

OnStartClient() private method

private OnStartClient ( ) : void
return void
        internal void OnStartClient()
        {
            if (!this.m_IsClient)
            {
                this.m_IsClient = true;
            }
            this.CacheBehaviours();
            if (LogFilter.logDev)
            {
                Debug.Log(string.Concat(new object[] { "OnStartClient ", base.gameObject, " GUID:", this.netId, " localPlayerAuthority:", this.localPlayerAuthority }));
            }
            for (int i = 0; i < this.m_NetworkBehaviours.Length; i++)
            {
                NetworkBehaviour behaviour = this.m_NetworkBehaviours[i];
                try
                {
                    behaviour.PreStartClient();
                    behaviour.OnStartClient();
                }
                catch (Exception exception)
                {
                    Debug.LogError("Exception in OnStartClient:" + exception.Message + " " + exception.StackTrace);
                }
            }
        }

Usage Example

        static void ApplySpawnPayload(NetworkIdentity uv, Vector3 position, byte[] payload, NetworkInstanceId netId, GameObject newGameObject, string data = "")
        {
            if (!uv.gameObject.activeSelf)
            {
                uv.gameObject.SetActive(true);
            }
            uv.transform.position = position;
            if (payload != null && payload.Length > 0)
            {
                var payloadReader = new NetworkReader(payload);
                uv.OnUpdateVars(payloadReader, true);
            }
            if (newGameObject == null)
            {
                return;
            }

            newGameObject.SetActive(true);
            uv.SetNetworkInstanceId(netId);
            SetLocalObject(netId, newGameObject);

            // objects spawned as part of initial state are started on a second pass
            if (s_IsSpawnFinished)
            {
                uv.OnStartClient();
                CheckForOwner(uv);
            }
        }
All Usage Examples Of UnityEngine.Networking.NetworkIdentity::OnStartClient