mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-30 13:33:07 +00:00
19 lines
535 B
C#
19 lines
535 B
C#
/// Credit tanoshimi
|
|
/// Sourced from - https://forum.unity3d.com/threads/read-only-fields.68976/
|
|
///
|
|
using UnityEditor;
|
|
|
|
namespace UnityEngine.UI.Extensions
|
|
{
|
|
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
|
|
public class ReadOnlyDrawer : PropertyDrawer
|
|
{
|
|
|
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
|
{
|
|
GUI.enabled = false;
|
|
EditorGUI.PropertyField(position, property, label, true);
|
|
GUI.enabled = true;
|
|
}
|
|
}
|
|
}
|