Skip to content

Commit

Permalink
perf: remove syncvar boxing (#927)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpach committed Jun 23, 2019
1 parent 9e911b9 commit b2ba589
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Assets/Mirror/Runtime/NetworkBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,7 @@ protected NetworkIdentity GetSyncVarNetworkIdentity(uint netId, ref NetworkIdent
protected void SetSyncVar<T>(T value, ref T fieldValue, ulong dirtyBit)
{
// newly initialized or changed value?
if ((value == null && fieldValue != null) ||
(value != null && !value.Equals(fieldValue)))
if (!EqualityComparer<T>.Default.Equals(value, fieldValue))
{
if (LogFilter.Debug) Debug.Log("SetSyncVar " + GetType().Name + " bit [" + dirtyBit + "] " + fieldValue + "->" + value);
SetDirtyBit(dirtyBit);
Expand Down

0 comments on commit b2ba589

Please sign in to comment.