using null propagation for RemoveOwnedObject (#2347)

This commit is contained in:
James Frowen 2020-10-20 01:33:20 +01:00 committed by vis2k
parent 09d38977d5
commit ebc9f7a4b3
2 changed files with 2 additions and 4 deletions

View File

@ -117,7 +117,7 @@ public NetworkIdentity netIdentity
// do this 2nd check inside first if so that we are not checking == twice on unity Object
if (netIdentityCache is null)
{
logger.LogError("There is no NetworkIdentity on " + name + ". Please add one.");
Debug.LogError("There is no NetworkIdentity on " + name + ". Please add one.");
}
}
return netIdentityCache;

View File

@ -214,9 +214,7 @@ public NetworkConnectionToClient connectionToClient
internal set
{
if (_connectionToClient != null)
_connectionToClient.RemoveOwnedObject(this);
_connectionToClient?.RemoveOwnedObject(this);
_connectionToClient = value;
_connectionToClient?.AddOwnedObject(this);
}