// MIT License - Copyright (c) 2025 wallstop // Full license text: https://github.com/wallstop/unity-helpers/blob/main/LICENSE namespace WallstopStudios.UnityHelpers.Editor.CustomDrawers { #if UNITY_EDITOR && ODIN_INSPECTOR using Sirenix.OdinInspector.Editor; using UnityEngine; using WallstopStudios.UnityHelpers.Core.Attributes; /// /// Odin Inspector attribute drawer for . /// Makes fields non-editable (display only) in the inspector. /// /// /// This drawer ensures WReadOnly works correctly when Odin Inspector is installed /// and classes derive from SerializedMonoBehaviour or SerializedScriptableObject, /// where Unity's standard PropertyDrawer system is bypassed. /// public sealed class WReadOnlyOdinDrawer : OdinAttributeDrawer { protected override void DrawPropertyLayout(GUIContent label) { bool previousEnabled = GUI.enabled; try { GUI.enabled = false; CallNextDrawer(label); } finally { GUI.enabled = previousEnabled; } } } #endif }