diff --git a/Assets/Mirage/Editor/Drawers/SyncSettingsDrawer.cs b/Assets/Mirage/Editor/Drawers/SyncSettingsDrawer.cs index 4eafdc48c7..6b3f75caa9 100644 --- a/Assets/Mirage/Editor/Drawers/SyncSettingsDrawer.cs +++ b/Assets/Mirage/Editor/Drawers/SyncSettingsDrawer.cs @@ -1,3 +1,4 @@ +using System.Reflection; using UnityEditor; using UnityEngine; @@ -17,9 +18,16 @@ private static bool NoSyncInBehaviour(SerializedProperty property) foreach (var target in targets) { Debug.Assert(target is NetworkBehaviour); + + // show if syncvars var syncAny = InspectorHelper.SyncsAnything(target); if (syncAny) return false; + + // show if attribute + var showAttr = target.GetType().GetCustomAttributes(true); + if (showAttr != null) + return false; } return true; } diff --git a/Assets/Mirage/Runtime/CustomAttributes.cs b/Assets/Mirage/Runtime/CustomAttributes.cs index c3942bc32b..fb0b4e6717 100644 --- a/Assets/Mirage/Runtime/CustomAttributes.cs +++ b/Assets/Mirage/Runtime/CustomAttributes.cs @@ -258,4 +258,10 @@ public sealed class ReadOnlyInspectorAttribute : PropertyAttribute { } /// [AttributeUsage(AttributeTargets.Field)] public sealed class NetworkedPrefabAttribute : PropertyAttribute { } + + /// + /// Add to NetworkBehaviour to force SyncSettings to be drawn, even if there are no syncvars + /// + [AttributeUsage(AttributeTargets.Class)] + public sealed class ShowSyncSettingsAttribute : Attribute { } }