/// <summary> /// Draw a readonly property field. /// </summary> /// <param name="_position">Rect to draw field in.</param> /// <param name="_property">Property to display.</param> /// <param name="_label">Label to display before property.</param> /// <param name="_useRadioToggle">If property is boolean type, indicates if using radio toggle or standard one.</param> public static void ReadOnlyProperty(SerializedProperty _property, GUIContent _label, bool _useRadioToggle = false) { // Get field rect Rect _position = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight); // Draw it EditorGUIEnhanced.ReadOnlyProperty(_position, _property, _label, _useRadioToggle); }
/*************************** ******* METHODS ******* **************************/ // Make your own IMGUI based GUI for the property public override void OnGUI(Rect _position, SerializedProperty _property, GUIContent _label) { ReadOnlyAttribute _attribute = (ReadOnlyAttribute)attribute; EditorGUIEnhanced.ReadOnlyProperty(_position, _property, _label, _attribute.UseRadioToggle); }