@@ -402,7 +402,6 @@ public void DeferDespawn(int tickOffset, bool destroy = true)
402402 {
403403 NetworkLog . LogErrorServer ( $ "[{ name } ] This method is only available in distributed authority mode.") ;
404404 }
405-
406405 return ;
407406 }
408407
@@ -412,11 +411,10 @@ public void DeferDespawn(int tickOffset, bool destroy = true)
412411 {
413412 NetworkLog . LogErrorServer ( $ "[{ name } ] Cannot defer despawn while not spawned.") ;
414413 }
415-
416414 return ;
417415 }
418416
419- if ( ! HasAuthority )
417+ if ( ! InternalHasAuthority ( ) )
420418 {
421419 if ( NetworkManagerOwner . LogLevel <= LogLevel . Error )
422420 {
@@ -628,12 +626,11 @@ public bool SetOwnershipLock(bool lockOwnership = true)
628626 {
629627 NetworkLog . LogErrorServer ( $ "[{ name } ][Attempted Lock While not spawned]") ;
630628 }
631-
632629 return false ;
633630 }
634631
635632 // If we don't have authority exit early
636- if ( ! HasAuthority )
633+ if ( ! InternalHasAuthority ( ) )
637634 {
638635 if ( NetworkManager . LogLevel <= LogLevel . Error )
639636 {
@@ -671,7 +668,6 @@ public bool SetOwnershipLock(bool lockOwnership = true)
671668 {
672669 SendOwnershipStatusUpdate ( ) ;
673670 }
674-
675671 return true ;
676672 }
677673
@@ -797,7 +793,6 @@ public OwnershipRequestStatus RequestOwnership()
797793 {
798794 NetworkLog . LogErrorServer ( $ "[{ name } ][Invalid Operation] Cannot request ownership of an NetworkObject before it is spawned.") ;
799795 }
800-
801796 return OwnershipRequestStatus . InvalidOperation ;
802797 }
803798 // Exit early the local client is already the owner
@@ -909,7 +904,7 @@ internal void OwnershipRequest(ulong clientRequestingOwnership)
909904
910905 // This action is always authorized as long as the client still has authority.
911906 // We need to pass in that this is a request approval ownership change.
912- NetworkManagerOwner . SpawnManager . ChangeOwnership ( this , clientRequestingOwnership , HasAuthority , true ) ;
907+ NetworkManagerOwner . SpawnManager . ChangeOwnership ( this , clientRequestingOwnership , InternalHasAuthority ( ) , true ) ;
913908 }
914909 else
915910 {
@@ -1158,7 +1153,7 @@ public bool HasOwnershipStatus(OwnershipStatus status)
11581153 public bool HasAuthority => InternalHasAuthority ( ) ;
11591154
11601155 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
1161- private bool InternalHasAuthority ( )
1156+ internal bool InternalHasAuthority ( )
11621157 {
11631158 if ( ! IsSpawned )
11641159 {
@@ -1509,7 +1504,7 @@ public void NetworkShow(ulong clientId)
15091504 return ;
15101505 }
15111506
1512- if ( ! HasAuthority )
1507+ if ( ! InternalHasAuthority ( ) )
15131508 {
15141509 if ( NetworkManagerOwner . DistributedAuthorityMode )
15151510 {
@@ -1604,7 +1599,7 @@ public void NetworkHide(ulong clientId)
16041599 return ;
16051600 }
16061601
1607- if ( ! HasAuthority )
1602+ if ( ! InternalHasAuthority ( ) )
16081603 {
16091604 if ( NetworkManagerOwner . DistributedAuthorityMode )
16101605 {
@@ -1763,7 +1758,7 @@ private void OnDestroy()
17631758 {
17641759 // An authorized destroy is when done by the authority instance or done due to a scene event and the NetworkObject
17651760 // was marked as destroy pending scene event (which means the destroy with scene property was set).
1766- var isAuthorityDestroy = HasAuthority || NetworkManager . DAHost || DestroyPendingSceneEvent ;
1761+ var isAuthorityDestroy = InternalHasAuthority ( ) || NetworkManager . DAHost || DestroyPendingSceneEvent ;
17671762
17681763 // If the NetworkObject's GameObject is still valid and the scene is still valid and loaded, then we are still valid
17691764 var isStillValid = gameObject != null && gameObject . scene . IsValid ( ) && gameObject . scene . isLoaded ;
@@ -2102,7 +2097,7 @@ public void ChangeOwnership(ulong newOwnerClientId)
21022097 }
21032098 return ;
21042099 }
2105- NetworkManagerOwner . SpawnManager . ChangeOwnership ( this , newOwnerClientId , HasAuthority ) ;
2100+ NetworkManagerOwner . SpawnManager . ChangeOwnership ( this , newOwnerClientId , InternalHasAuthority ( ) ) ;
21062101 }
21072102
21082103 /// <summary>
@@ -2337,7 +2332,7 @@ public bool TrySetParent(NetworkObject parent, bool worldPositionStays = true)
23372332
23382333 // DANGO-TODO: Do we want to worry about ownership permissions here?
23392334 // It wouldn't make sense to not allow parenting, but keeping this note here as a reminder.
2340- var isAuthority = HasAuthority || ( AllowOwnerToParent && IsOwner ) ;
2335+ var isAuthority = InternalHasAuthority ( ) || ( AllowOwnerToParent && IsOwner ) ;
23412336
23422337 // If we don't have authority and we are not shutting down, then don't allow any parenting.
23432338 // If we are shutting down and don't have authority then allow it.
@@ -2412,7 +2407,7 @@ private void OnTransformParentChanged()
24122407
24132408 // With distributed authority, we need to track "valid authoritative" parenting changes.
24142409 // So, either the authority or AuthorityAppliedParenting is considered a "valid parenting change".
2415- var isParentingAuthority = HasAuthority || AuthorityAppliedParenting || ( AllowOwnerToParent && IsOwner ) ;
2410+ var isParentingAuthority = InternalHasAuthority ( ) || AuthorityAppliedParenting || ( AllowOwnerToParent && IsOwner ) ;
24162411 // If we are spawned and don't have authority; reset the parent back to the cached parent and exit
24172412 if ( ! isParentingAuthority )
24182413 {
@@ -3407,7 +3402,6 @@ internal static NetworkObject Deserialize(in SerializedObject serializedObject,
34073402 {
34083403 Destroy ( networkObject . gameObject ) ;
34093404 }
3410-
34113405 return null ;
34123406 }
34133407
@@ -3529,7 +3523,7 @@ internal void SceneChangedUpdate(Scene scene, bool notify = false)
35293523 return ;
35303524 }
35313525
3532- var isAuthority = HasAuthority ;
3526+ var isAuthority = InternalHasAuthority ( ) ;
35333527 SceneOriginHandle = scene . handle ;
35343528
35353529 // non-authority needs to update the NetworkSceneHandle
0 commit comments