mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
SyncVarGameObject/NetworkBehaviour/NetworkIdentity .Equals/.GetHashCode too
This commit is contained in:
parent
f03dd3f8b8
commit
0fd0aa2135
@ -127,5 +127,9 @@ static GameObject GetGameObject(uint netId)
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(GameObject a, SyncVarGameObject b) => !(a == b);
|
||||
|
||||
// if we overwrite == operators, we also need to overwrite .Equals.
|
||||
public override bool Equals(object obj) => obj is SyncVarGameObject value && this == value;
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +80,10 @@ public SyncVarNetworkBehaviour(T value = null)
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(NetworkBehaviour a, SyncVarNetworkBehaviour<T> b) => !(a == b);
|
||||
|
||||
// if we overwrite == operators, we also need to overwrite .Equals.
|
||||
public override bool Equals(object obj) => obj is SyncVarNetworkBehaviour<T> value && this == value;
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
|
||||
// helper functions to get/set netId, componentIndex from ulong
|
||||
internal static ulong Pack(uint netId, byte componentIndex)
|
||||
{
|
||||
|
@ -102,5 +102,9 @@ public SyncVarNetworkIdentity(NetworkIdentity value = null)
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(NetworkIdentity a, SyncVarNetworkIdentity b) => !(a == b);
|
||||
|
||||
// if we overwrite == operators, we also need to overwrite .Equals.
|
||||
public override bool Equals(object obj) => obj is SyncVarNetworkIdentity value && this == value;
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user