mirror of
https://github.com/Steffo99/gravity-fusion.git
synced 2024-11-28 19:14:30 +00:00
22 lines
784 B
C#
22 lines
784 B
C#
|
//From https://answers.unity.com/questions/442342/how-to-make-public-variable-read-only-during-run-t.html
|
||
|
using UnityEngine;
|
||
|
using UnityEditor;
|
||
|
|
||
|
[CustomPropertyDrawer(typeof(AfterStart))]
|
||
|
public class AfterStartAttributeDrawer : PropertyDrawer
|
||
|
{
|
||
|
// Necessary since some properties tend to collapse smaller than their content
|
||
|
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||
|
{
|
||
|
return EditorGUI.GetPropertyHeight(property, label, true);
|
||
|
}
|
||
|
|
||
|
// Draw a disabled property field
|
||
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||
|
{
|
||
|
GUI.enabled = Application.isPlaying;
|
||
|
EditorGUI.PropertyField(position, property, label, true);
|
||
|
GUI.enabled = true;
|
||
|
}
|
||
|
}
|