NetworkTransformBase - OnClientAuthorityChanged is Server Only

This commit is contained in:
MrGadget1024 2023-01-20 19:32:06 -05:00
parent 2239bb0245
commit 22ac763199

View File

@ -281,15 +281,20 @@ public virtual void Reset()
protected virtual void OnEnable()
{
Reset();
NetworkIdentity.clientAuthorityCallback += OnClientAuthorityChanged;
if (NetworkServer.active)
NetworkIdentity.clientAuthorityCallback += OnClientAuthorityChanged;
}
protected virtual void OnDisable()
{
Reset();
NetworkIdentity.clientAuthorityCallback -= OnClientAuthorityChanged;
if (NetworkServer.active)
NetworkIdentity.clientAuthorityCallback -= OnClientAuthorityChanged;
}
[ServerCallback]
void OnClientAuthorityChanged(NetworkConnectionToClient conn, NetworkIdentity identity, bool authorityState)
{
if (identity != netIdentity) return;