Skip to content

Commit 3d7ebed

Browse files
authored
fix(NetworkBehaviourInspector): Use showSyncMethod (#4024)
1 parent 3093b95 commit 3d7ebed

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ protected override void OnValidate()
148148
Configure();
149149
}
150150

151+
// For NetworkBehaviourInspector
152+
internal override bool showSyncMethod() => false;
153+
151154
// initialization //////////////////////////////////////////////////////
152155
// forcec configuration of some settings
153156
protected virtual void Configure()

Assets/Mirror/Core/NetworkBehaviour.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ public bool authority
121121
// NetworkBehaviourInspector needs to know if we have SyncObjects
122122
internal bool HasSyncObjects() => syncObjects.Count > 0;
123123

124+
// NetworkBehaviourInspector needs to know if it should show SyncMethod dropdown
125+
internal virtual bool showSyncMethod() => true;
126+
124127
// NetworkIdentity based values set from NetworkIdentity.Awake(),
125128
// which is way more simple and way faster than trying to figure out
126129
// component index from in here by searching all NetworkComponents.

Assets/Mirror/Editor/NetworkBehaviourInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected void DrawDefaultSyncSettings()
9696
EditorGUILayout.PropertyField(serializedObject.FindProperty("syncMode"));
9797

9898
// sync method: Don't show for NT-based components
99-
if (!typeof(NetworkTransformBase).IsAssignableFrom(scriptClass))
99+
if (((NetworkBehaviour)serializedObject.targetObject).showSyncMethod())
100100
{
101101
SerializedProperty syncMethod = serializedObject.FindProperty("syncMethod");
102102
EditorGUILayout.PropertyField(syncMethod);

0 commit comments

Comments
 (0)