mirror of
https://github.com/AnnulusGames/Alchemy.git
synced 2025-01-22 08:18:51 -05:00
Fix: InlineField attribute not working
This commit is contained in:
parent
f6526b3cc1
commit
c463f36882
@ -3,6 +3,7 @@ using UnityEngine.Assertions;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEditor;
|
||||
using UnityEditor.UIElements;
|
||||
using Alchemy.Inspector;
|
||||
|
||||
namespace Alchemy.Editor.Elements
|
||||
{
|
||||
@ -29,19 +30,31 @@ namespace Alchemy.Editor.Elements
|
||||
|
||||
foldout.BindProperty(property);
|
||||
|
||||
field = GUIHelper.CreateObjectPropertyField(property, type);
|
||||
field = new ObjectField()
|
||||
{
|
||||
label = ObjectNames.NicifyVariableName(property.displayName),
|
||||
objectType = type,
|
||||
allowSceneObjects = property.GetFieldInfo().HasCustomAttribute<AssetsOnlyAttribute>(),
|
||||
value = property.objectReferenceValue
|
||||
};
|
||||
field.style.position = Position.Absolute;
|
||||
field.style.width = Length.Percent(100f);
|
||||
GUIHelper.ScheduleAdjustLabelWidth(field);
|
||||
|
||||
// OnPropertyChanged(property);
|
||||
field.RegisterValueChangeCallback(x => OnPropertyChanged(x.changedProperty));
|
||||
OnPropertyChanged(property);
|
||||
field.RegisterValueChangedCallback(x =>
|
||||
{
|
||||
property.objectReferenceValue = x.newValue;
|
||||
property.serializedObject.ApplyModifiedProperties();
|
||||
OnPropertyChanged(property);
|
||||
});
|
||||
|
||||
Add(foldout);
|
||||
Add(field);
|
||||
}
|
||||
|
||||
readonly Foldout foldout;
|
||||
readonly PropertyField field;
|
||||
readonly ObjectField field;
|
||||
readonly int depth;
|
||||
bool isNull;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user