Initialer Upload neues Unity-Projekt
This commit is contained in:
16
Assets/Convai/Scripts/Editor/UI/ReadOnlyDrawer.cs
Normal file
16
Assets/Convai/Scripts/Editor/UI/ReadOnlyDrawer.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Convai.Scripts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
|
||||
public class ReadOnlyDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
GUI.enabled = false; // Disable the property field
|
||||
EditorGUI.PropertyField(position, property, label, true);
|
||||
GUI.enabled = true; // Re-enable the property field
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user