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:
Oliver Biwer 2019-11-13 22:16:56 +01:00 committed by GitHub
commit 1c8964e30f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)