com.alicizax.unity.editor.e.../Editor/Toolbar/SerializableValues/PropertyVariable.cs
2025-08-01 19:32:29 +08:00

27 lines
781 B
C#

using System.Collections;
using System.Reflection;
namespace Paps.UnityToolbarExtenderUIToolkit
{
internal class PropertyVariable : Variable
{
public readonly PropertyInfo Property;
public PropertyVariable(MainToolbarElement element, PropertyInfo property, IValueSerializer valueSerializer, SerializeAttribute attribute)
: base(element, property.PropertyType, property.GetValue(element.VisualElement), valueSerializer, attribute)
{
Property = property;
}
public override object Get()
{
return Property.GetValue(Element.VisualElement);
}
public override void Set(object value)
{
Property.SetValue(Element.VisualElement, value);
}
}
}