diff --git a/Assets/Mirror/Core/InterestManagement.cs b/Assets/Mirror/Core/InterestManagement.cs index 3516339ef..88ead0ffb 100644 --- a/Assets/Mirror/Core/InterestManagement.cs +++ b/Assets/Mirror/Core/InterestManagement.cs @@ -54,7 +54,7 @@ public override void Rebuild(NetworkIdentity identity, bool initialize) newObservers.Clear(); // not force hidden? - if (identity.visible != Visibility.ForceHidden) + if (identity.visibility != Visibility.ForceHidden) { OnRebuildObservers(identity, newObservers); } diff --git a/Assets/Mirror/Core/NetworkIdentity.cs b/Assets/Mirror/Core/NetworkIdentity.cs index 086c0a645..1d67b6ee2 100644 --- a/Assets/Mirror/Core/NetworkIdentity.cs +++ b/Assets/Mirror/Core/NetworkIdentity.cs @@ -200,7 +200,17 @@ internal set // // TODO rename to 'visibility' after removing .visibility some day! [Tooltip("Visibility can overwrite interest management. ForceHidden can be useful to hide monsters while they respawn. ForceShown can be useful for score NetworkIdentities that should always broadcast to everyone in the world.")] - public Visibility visible = Visibility.Default; + [FormerlySerializedAs("visible")] + public Visibility visibility = Visibility.Default; + + // Deprecated 2024-01-21 + [HideInInspector] + [Obsolete("Deprecated - Use .visibility instead. This will be removed soon.")] + public Visibility visible + { + get => visibility; + set => visibility = value; + } // broadcasting serializes all entities around a player for each player. // we don't want to serialize one entity twice in the same tick. diff --git a/Assets/Mirror/Core/NetworkServer.cs b/Assets/Mirror/Core/NetworkServer.cs index c7ba80e89..09c013b34 100644 --- a/Assets/Mirror/Core/NetworkServer.cs +++ b/Assets/Mirror/Core/NetworkServer.cs @@ -1198,17 +1198,17 @@ static void SpawnObserversForConnection(NetworkConnectionToClient conn) // first! // ForceShown: add no matter what - if (identity.visible == Visibility.ForceShown) + if (identity.visibility == Visibility.ForceShown) { identity.AddObserver(conn); } // ForceHidden: don't show no matter what - else if (identity.visible == Visibility.ForceHidden) + else if (identity.visibility == Visibility.ForceHidden) { // do nothing } // default: legacy system / new system / no system support - else if (identity.visible == Visibility.Default) + else if (identity.visibility == Visibility.Default) { // aoi system if (aoi != null) @@ -1674,7 +1674,7 @@ static void RebuildObserversDefault(NetworkIdentity identity, bool initialize) if (initialize) { // not force hidden? - if (identity.visible != Visibility.ForceHidden) + if (identity.visibility != Visibility.ForceHidden) { AddAllReadyServerConnectionsToObservers(identity); } @@ -1717,7 +1717,7 @@ public static void RebuildObservers(NetworkIdentity identity, bool initialize) { // if there is no interest management system, // or if 'force shown' then add all connections - if (aoi == null || identity.visible == Visibility.ForceShown) + if (aoi == null || identity.visibility == Visibility.ForceShown) { RebuildObserversDefault(identity, initialize); } diff --git a/Assets/Mirror/Tests/Editor/InterestManagement/InterestManagementTests_Default.cs b/Assets/Mirror/Tests/Editor/InterestManagement/InterestManagementTests_Default.cs index 048277ef7..d158ded86 100644 --- a/Assets/Mirror/Tests/Editor/InterestManagement/InterestManagementTests_Default.cs +++ b/Assets/Mirror/Tests/Editor/InterestManagement/InterestManagementTests_Default.cs @@ -11,7 +11,7 @@ public class InterestManagementTests_Default : InterestManagementTests_Common public override void ForceHidden_Initial() { // force hide A - identityA.visible = Visibility.ForceHidden; + identityA.visibility = Visibility.ForceHidden; // rebuild for both // initial rebuild adds all connections if no interest management available @@ -30,7 +30,7 @@ public override void ForceHidden_Initial() public override void ForceShown_Initial() { // force show A - identityA.visible = Visibility.ForceShown; + identityA.visibility = Visibility.ForceShown; // rebuild for both // initial rebuild adds all connections if no interest management available diff --git a/Assets/Mirror/Tests/Editor/InterestManagement/InterestManagementTests_Distance.cs b/Assets/Mirror/Tests/Editor/InterestManagement/InterestManagementTests_Distance.cs index 17276f554..5f25010a2 100644 --- a/Assets/Mirror/Tests/Editor/InterestManagement/InterestManagementTests_Distance.cs +++ b/Assets/Mirror/Tests/Editor/InterestManagement/InterestManagementTests_Distance.cs @@ -36,7 +36,7 @@ public override void ForceHidden_Initial() // A and B are at (0,0,0) so within range! // force hide A - identityA.visible = Visibility.ForceHidden; + identityA.visibility = Visibility.ForceHidden; // rebuild for both // initial rebuild while both are within range @@ -58,7 +58,7 @@ public override void ForceShown_Initial() identityB.transform.position = Vector3.right * (aoi.visRange + 1); // force show A - identityA.visible = Visibility.ForceShown; + identityA.visibility = Visibility.ForceShown; // rebuild for both // initial rebuild while both are within range diff --git a/Assets/Mirror/Tests/Editor/InterestManagement/InterestManagementTests_SpatialHashing.cs b/Assets/Mirror/Tests/Editor/InterestManagement/InterestManagementTests_SpatialHashing.cs index 8fdc13458..9a708ed21 100644 --- a/Assets/Mirror/Tests/Editor/InterestManagement/InterestManagementTests_SpatialHashing.cs +++ b/Assets/Mirror/Tests/Editor/InterestManagement/InterestManagementTests_SpatialHashing.cs @@ -39,7 +39,7 @@ public override void ForceHidden_Initial() // A and B are at (0,0,0) so within range! // force hide A - identityA.visible = Visibility.ForceHidden; + identityA.visibility = Visibility.ForceHidden; // rebuild for both // initial rebuild while both are within range @@ -61,7 +61,7 @@ public override void ForceShown_Initial() identityB.transform.position = Vector3.right * (aoi.visRange + 1); // force show A - identityA.visible = Visibility.ForceShown; + identityA.visibility = Visibility.ForceShown; // update grid now that positions were changed aoi.Update();