#thats how it currently looks
1 messages · Page 1 of 1 (latest)
Hmmm when you call BindItem can you bind the property to (new SerializedObject(ConsiderationAxis).FindProperty(nameof(responseCurve)?
But I could be wrong on the depth. It's kinda hard to tell with out looking at any code
ConsiderationAxis is not a Unity.Object so i cant.
ill try to show some code
oh because it's not a scriptable object...
{
public Port port;
public CurveField animCurve = new CurveField();
public AxisInputElement(ConsiderationNode node,ConsiderationScrObj scriptableObjectData)
{
port = node.InstantiatePort(Orientation.Horizontal, Direction.Input, Port.Capacity.Single, typeof(ConsiderationPortType));
Add(port);
Add(animCurve);
}
}``` that is the element i create in MakeItem
and then id just like to somehow bind it : Action<VisualElement, int> bindItem = (e, i) => { var element = (e as AxisInputVisualElement2); element.animCurve.value = scriptableObjectData.axis[i].responseCurve.responseCurveGraph; };
but that binding doesnt work
That doesn't work at all? or it doesn't update when you update the scriptable object?
When i change the ScrObj data it is not updated. only if i call Refresh on the ListView it is
as i understand it it is because i create everything from scratch again then
ok so the bindItem is working, its just not propagating the scriptable obj change
but it is bound though? or do i just once assign the value from the scr obj?
Yea I guess thats true, I'm new to UI terminology.
i have not defined a bindingpath anywhere
i am new to this as well. i feel like im not grasping the basics here
Have you tried deriving ConsiderationAxis from scriptable object? that way you can use it as a SerializedObject?
i mean it kinda is serialized on a scriptable object but inside a list right?
i cant make a scriptable object out of it though.
Yea it is serialized inside the list
You can only bind to serialized properties. This means you can only bind visual elements to the following objects that are compatible with the Serialization system:
User-defined ScriptableObject classes
User-defined MonoBehaviour classes
Native Unity component types
Native Unity asset types
Primitive C# types such as int, bool, float, and so on.
Native Unity types such as Vector3, Color, Object, and so on.
I think these requirments are what are messing you up https://docs.unity3d.com/Manual/UIE-Binding.html
but animationcurve is in there afaik
Since you are trying to bind to a Unity component inside of a user Defined class
If you had say an array of animationcurve's then I think you could bind to it just fine
i found this but i dont really understand whats happening
I would try to see if you can get basic binding done. Just a quick test from an animationcurve inside of a SO
I found the same link but don't understand it either lol
i tried with sliders and values and that worked
But after you confim that you can bind to an animationcurve I would post to the forums and ask your question with more detail and code.
You might get lucky and have someone from Unity help you out
okay thanks alot! ill try that
Yea no problem. Thanks for your help. and Hopfully you can figure your issue out!
just quick followup: yes animationcuve and curvefield binding works like a charm
Awesome, now you know at least that its possible