using Unity.Netcode.Components; #if UNITY_UNET_PRESENT using Unity.Netcode.Transports.UNET; #endif using Unity.Netcode.Transports.UTP; using UnityEditor; namespace Unity.Netcode.Editor { /// /// Internal use. Hides the script field for the given component. /// public class HiddenScriptEditor : UnityEditor.Editor { private static readonly string[] k_HiddenFields = { "m_Script" }; /// /// Draws inspector properties without the script field. /// public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); serializedObject.UpdateIfRequiredOrScript(); DrawPropertiesExcluding(serializedObject, k_HiddenFields); serializedObject.ApplyModifiedProperties(); EditorGUI.EndChangeCheck(); } } #if UNITY_UNET_PRESENT /// /// Internal use. Hides the script field for UNetTransport. /// [CustomEditor(typeof(UNetTransport), true)] public class UNetTransportEditor : HiddenScriptEditor { } #endif /// /// Internal use. Hides the script field for UnityTransport. /// [CustomEditor(typeof(UnityTransport), true)] public class UnityTransportEditor : HiddenScriptEditor { } #if COM_UNITY_MODULES_ANIMATION /// /// Internal use. Hides the script field for NetworkAnimator. /// [CustomEditor(typeof(NetworkAnimator), true)] public class NetworkAnimatorEditor : HiddenScriptEditor { } #endif #if COM_UNITY_MODULES_PHYSICS /// /// Internal use. Hides the script field for NetworkRigidbody. /// [CustomEditor(typeof(NetworkRigidbody), true)] public class NetworkRigidbodyEditor : HiddenScriptEditor { } #endif #if COM_UNITY_MODULES_PHYSICS2D /// /// Internal use. Hides the script field for NetworkRigidbody2D. /// [CustomEditor(typeof(NetworkRigidbody2D), true)] public class NetworkRigidbody2DEditor : HiddenScriptEditor { } #endif }