#if UNITY_EDITOR && ENABLE_NETCODE using Unity.Netcode; using UnityEditor; using UnityEngine; namespace Utils { [CustomEditor(typeof(NetworkBehaviour), true)] public class DefaultNetworkBehaviourEditor : Editor { private bool hideScriptField; private void OnEnable() { hideScriptField = target.GetType().GetCustomAttributes(typeof(HideScriptField), false).Length > 0; } public override void OnInspectorGUI() { if (hideScriptField) { serializedObject.Update(); EditorGUI.BeginChangeCheck(); DrawPropertiesExcluding(serializedObject, "m_Script"); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } } else { base.OnInspectorGUI(); } } } } #endif