public static GameObject ReadGameObject(this NetworkReader reader) { NetworkIdentity identity = reader.ReadNetworkIdentity(); if (identity == null) { return(null); } return(identity.gameObject); }
public static NetworkBehaviour ReadNetworkBehaviour(this NetworkReader reader) { NetworkIdentity identity = reader.ReadNetworkIdentity(); if (identity == null) { return(null); } byte componentIndex = reader.ReadByte(); return(identity.NetworkBehaviours[componentIndex]); }