Morulus
12/8/2019 - 12:48 PM

Unity UIElement bind to serialized property

SerializedObject serializedObject = new SerializedObject(target);
string name = "somePropName";

/* Create UIElement instance (I use BindableElement type, but in the real case it can be Toogle, FloatField, etc) */
BindableElement element = new BindableElement();

/* Enable it */
element.SetEnabled(true);
element.Bind(serializedObject);
element.bindingPath = name;