mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
perf: remove syncvar boxing (#927)
This commit is contained in:
parent
9e911b9d5e
commit
b2ba5896fa
@ -423,8 +423,7 @@ protected NetworkIdentity GetSyncVarNetworkIdentity(uint netId, ref NetworkIdent
|
|||||||
protected void SetSyncVar<T>(T value, ref T fieldValue, ulong dirtyBit)
|
protected void SetSyncVar<T>(T value, ref T fieldValue, ulong dirtyBit)
|
||||||
{
|
{
|
||||||
// newly initialized or changed value?
|
// newly initialized or changed value?
|
||||||
if ((value == null && fieldValue != null) ||
|
if (!EqualityComparer<T>.Default.Equals(value, fieldValue))
|
||||||
(value != null && !value.Equals(fieldValue)))
|
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) Debug.Log("SetSyncVar " + GetType().Name + " bit [" + dirtyBit + "] " + fieldValue + "->" + value);
|
if (LogFilter.Debug) Debug.Log("SetSyncVar " + GetType().Name + " bit [" + dirtyBit + "] " + fieldValue + "->" + value);
|
||||||
SetDirtyBit(dirtyBit);
|
SetDirtyBit(dirtyBit);
|
||||||
|
Loading…
Reference in New Issue
Block a user