vhristov

Hi,

I recently tried to use Odin's OnValueChanged attribute in combination with SpineBone/SpineAnimation attributes and got some weird behavior where the OnValueChanged function was called on the previous value, even before I had clicked on any of the items in the menu and never called again when I actually change the value

The test code I used was this:
[SpineBone(dataField: "spineSkeletonAnimation")]
[OnValueChanged("TestChanged")]
public string test;

public void TestChanged()
{
Debug.Log(test);
}
I can see the Debug.Log getting shown in the console almost immediately after I click the menu is shown on screen.

Is there anyone here in the forum that is using both Spine and Odin in such a way? If so, do you know what might be happening here?
vhristov
  • 記事: 36

Harald

Unfortunately I'm not familiar with Odin's OnValueChanged implementation. Is it implemented via CustomPropertyDrawer?

Could you perhaps paste the Debug Log statements here?
アバター
Harald

Harri
  • 記事: 3353

vhristov

Harald さんが書きました:Unfortunately I'm not familiar with Odin's OnValueChanged implementation. Is it implemented via CustomPropertyDrawer?
To be honest I don't know. When I bought Odin Inspector, I decided to keep my self out of trouble and bought only the closed source version (which I feel sorry from time to time, but I am sure I saved enough time by staying away of the source :) )
What I believe they do is to implement a custom inspector (and draw everything that is not drawn with another custom inspector using their own methods). This way they can provide us with some nice attributes (both for styling and change notifications and other).

Anyway I was able to workaround the issue using unity's OnValidate calls so this is not a something that I really need at the moment, but I am still curious why it doesn't work.
Harald さんが書きました:Could you perhaps paste the Debug Log statements here?
There is nothing really interesting there. There is no crash or anything, just the names of the bones that I selected on the previous click.

P.S.
I don't believe there is any bug on the Spine side here, if there is really an issue here I would say it is more of a incompatibility between spine and odin inspector (or bug in odin inspector).
Harald, if you can give me a few hints where the the actual assignment of the value is happening when selecting a bone, so I can ask Odin's people if they have a problem there it would be nice.
vhristov
  • 記事: 36

Harald

vhristov さんが書きました:Harald, if you can give me a few hints where the the actual assignment of the value is happening when selecting a bone, so I can ask Odin's people if they have a problem there it would be nice.
Sure, it is handled in SpineAttributeDrawers.cs, class SpineBoneDrawer.
The relevant lines are:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineAttributeDrawers.cs#L536
https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineAttributeDrawers.cs#L158
アバター
Harald

Harri
  • 記事: 3353


Return to Unity