45using System.Runtime.CompilerServices;
56 public new GameObject Value
58 [MethodImpl(MethodImplOptions.AggressiveInlining)]
59 get => GetGameObject(base.Value);
60 [MethodImpl(MethodImplOptions.AggressiveInlining)]
61 set => base.Value = GetNetId(value);
66 public new event Action<GameObject, GameObject> Callback;
69 [MethodImpl(MethodImplOptions.AggressiveInlining)]
70 protected override void InvokeCallback(uint oldValue, uint newValue) =>
71 Callback?.Invoke(GetGameObject(oldValue), GetGameObject(newValue));
79 : base(GetNetId(value)) {}
82 [MethodImpl(MethodImplOptions.AggressiveInlining)]
83 static uint GetNetId(GameObject go)
88 return identity !=
null ? identity.netId : 0;
94 [MethodImpl(MethodImplOptions.AggressiveInlining)]
95 static GameObject GetGameObject(uint netId)
98 return spawned !=
null ? spawned.gameObject :
null;
102 [MethodImpl(MethodImplOptions.AggressiveInlining)]
103 public static implicit
operator GameObject(
SyncVarGameObject field) => field.Value;
107 [MethodImpl(MethodImplOptions.AggressiveInlining)]
111 [MethodImpl(MethodImplOptions.AggressiveInlining)]
115 [MethodImpl(MethodImplOptions.AggressiveInlining)]
123 [MethodImpl(MethodImplOptions.AggressiveInlining)]
127 [MethodImpl(MethodImplOptions.AggressiveInlining)]
131 [MethodImpl(MethodImplOptions.AggressiveInlining)]
135 [MethodImpl(MethodImplOptions.AggressiveInlining)]
139 [MethodImpl(MethodImplOptions.AggressiveInlining)]
140 public override bool Equals(
object obj) => obj is
SyncVarGameObject value &&
this == value;
142 [MethodImpl(MethodImplOptions.AggressiveInlining)]
143 public override int GetHashCode() => Value.GetHashCode();
NetworkIdentity identifies objects across the network.