Ejemplo n.º 1
0
 public static void WriteNetworkBehaviour(this NetworkWriter writer, NetworkBehaviour value)
 {
     if (value == null)
     {
         writer.WriteNetworkIdentity(null);
         return;
     }
     writer.WriteNetworkIdentity(value.Identity);
     writer.WriteByte((byte)value.ComponentIndex);
 }
Ejemplo n.º 2
0
        public static void WriteGameObject(this NetworkWriter writer, GameObject value)
        {
            if (value == null)
            {
                writer.WriteNetworkIdentity(null);
                return;
            }
            NetworkIdentity identity = value.GetComponent <NetworkIdentity>();

            if (identity == null)
            {
                throw new InvalidOperationException($"Cannot send GameObject without a NetworkIdentity {value.name}");
            }
            writer.WriteNetworkIdentity(identity);
        }