diff --git a/Assets/Scripts/Multiplayer/ZDisablerV2.cs b/Assets/Scripts/Multiplayer/ZDisablerV2.cs index 10b9e0e..a2fc28e 100644 --- a/Assets/Scripts/Multiplayer/ZDisablerV2.cs +++ b/Assets/Scripts/Multiplayer/ZDisablerV2.cs @@ -5,13 +5,19 @@ using UnityEngine; public class ZDisablerV2 : NetworkBehaviour { + [Tooltip("Keep enabled if is [BLANK]")] + public KeepIf KeepEnabledIf = KeepIf.IsOwner; [Tooltip("Add all the objects to disable on join, if not owner")] public UnityEngine.Object[] objectsToDisable; public override void OnNetworkSpawn() { // Run if networked - if (NetworkManager.Singleton == null || IsOwner) return; + if (NetworkManager.Singleton == null) return; + + if (KeepEnabledIf == KeepIf.IsOwner && IsOwner) return; + + if (KeepEnabledIf == KeepIf.IsServer && IsServer) return; for (int i = 0; i < objectsToDisable.Length; i++) { @@ -37,4 +43,11 @@ public class ZDisablerV2 : NetworkBehaviour } } } + + // Keep enabled if is [blank] + public enum KeepIf + { + IsServer, + IsOwner + } }