mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-22 08:08:51 -05:00
Merge pull request #88 from IceTrooper/#87-fixed-bug-with-multiline-constant-value-in-atomreference
Fix #87: AtomReference Drawer is always 1 line, even if the object needs more
This commit is contained in:
commit
1c8964e30f
@ -14,6 +14,19 @@ namespace UnityAtoms.Editor
|
||||
{ "Use Value", "Use Constant", "Use Variable" };
|
||||
private static GUIStyle _popupStyle;
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
SerializedProperty _usage = property.FindPropertyRelative("_usage");
|
||||
SerializedProperty _value = property.FindPropertyRelative("_value");
|
||||
SerializedProperty _constant = property.FindPropertyRelative("_constant");
|
||||
SerializedProperty _variable = property.FindPropertyRelative("_variable");
|
||||
|
||||
var usage = (AtomReference.Usage)_usage.intValue;
|
||||
var valueToUse = usage == AtomReference.Usage.Value ? _value : usage == AtomReference.Usage.Constant ? _constant : _variable;
|
||||
|
||||
return EditorGUI.GetPropertyHeight(valueToUse, label);
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
if (_popupStyle == null)
|
||||
|
Loading…
Reference in New Issue
Block a user