diff --git a/3d Prototyp/Assets/Editor/ShowOnlyDrawer.cs b/3d Prototyp/Assets/Editor/ShowOnlyDrawer.cs new file mode 100644 index 00000000..3d16cb32 --- /dev/null +++ b/3d Prototyp/Assets/Editor/ShowOnlyDrawer.cs @@ -0,0 +1,21 @@ +using UnityEditor; +using UnityEngine; + +[CustomPropertyDrawer(typeof(ShowOnlyAttribute))] +public class ShowOnlyDrawer : PropertyDrawer +{ + public override float GetPropertyHeight(SerializedProperty property, + GUIContent label) + { + return EditorGUI.GetPropertyHeight(property, label, true); + } + + public override void OnGUI(Rect position, + SerializedProperty property, + GUIContent label) + { + GUI.enabled = false; + EditorGUI.PropertyField(position, property, label, true); + GUI.enabled = true; + } +} diff --git a/3d Prototyp/Assets/Editor/ShowOnlyDrawer.cs.meta b/3d Prototyp/Assets/Editor/ShowOnlyDrawer.cs.meta new file mode 100644 index 00000000..eacdbde9 --- /dev/null +++ b/3d Prototyp/Assets/Editor/ShowOnlyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: adbb53bc6865b2f44adf93532a11a80e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/3d Prototyp/Assets/Scripts/ShowOnlyAttribute.cs b/3d Prototyp/Assets/Scripts/ShowOnlyAttribute.cs new file mode 100644 index 00000000..a13546dd --- /dev/null +++ b/3d Prototyp/Assets/Scripts/ShowOnlyAttribute.cs @@ -0,0 +1,8 @@ +using UnityEngine; + +/// +/// Das Feld wird im Inspector nur angezeigt und kann nicht verändert werden. +/// +public class ShowOnlyAttribute : PropertyAttribute +{ +} \ No newline at end of file diff --git a/3d Prototyp/Assets/Scripts/ShowOnlyAttribute.cs.meta b/3d Prototyp/Assets/Scripts/ShowOnlyAttribute.cs.meta new file mode 100644 index 00000000..41793f62 --- /dev/null +++ b/3d Prototyp/Assets/Scripts/ShowOnlyAttribute.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4218f171d49f43e9aaa8d2856e98fc06 +timeCreated: 1712225177 \ No newline at end of file