Jamez0r

Hey Harald and everyone :grinteeth:

I just noticed that the timing of Skeleton-reloading (from when you re-import a skeleton into Unity) is linked to the Preferences > General > Script Changes While Playing setting.

If it is set to "Recompile and Continue Playing" then the Skeleton's data will be updated while the game is running.

If it is set to "Recompile After Finished Playing" then the Skeleton's data will wait until the game has stopped to be updated.

I would like to keep the preference set to "Recompile After Finished Playing" so that my scripts wait to recompile, but I would like my Skeleton's data to update while the game is running. Would it be possible to have a checkbox in the Preferences > Spine, or some other way to do this?

We have a workflow setup where we can run the game once, place an NPC into a "test mode" and manually trigger its abilities/animations/etc. Our NPCs use a lot of spine-events, including for audio, and so it is extremely useful to be able to tweak the positions of those events in Spine, then re-export/import into Unity, (then "reload" the Skeleton for that NPC), and see if the tweaks are correct - all without having to stop and re-start the game. This workflow is great, and the only issue is not being able to keep the "Recompile After Finished Playing" setting for my scripts.

Thanks for any help!
Avatar
Jamez0r
  • Postovi: 356

Harald

We would be happy to add such a checkbox to the Spine Preferences, but unfortunately the Script Changes While Playing setting is only implicitly affecting skeleton reloading, we do not query this setting directly. The method SpineEditorUtilities.OnPostprocessAllAssets() which imports and updates the affected skeleton is no longer called at all when changing to Recompile After Finished Playing. :wounded: If you know any workaround, we are of course happy to integrate it.
Avatar
Harald

Harri
  • Postovi: 3914

Jamez0r

Harald je napisao/la:We would be happy to add such a checkbox to the Spine Preferences, but unfortunately the Script Changes While Playing setting is only implicitly affecting skeleton reloading, we do not query this setting directly. The method SpineEditorUtilities.OnPostprocessAllAssets() which imports and updates the affected skeleton is no longer called at all when changing to Recompile After Finished Playing. :wounded: If you know any workaround, we are of course happy to integrate it.
Ohh, gotcha.

I might do a little poking around to see what is going on there, but one quick question - could I just manually call that SpineEditorUtilities.OnPostprocessAllAssets() myself? We already have a button in an editor window that calls the "Reload" function on the existing Skeletons (since we're doing this while the game is running), so if all I need to do is also call that OnPostprocess function... :think:

Thanks Harald!!
Avatar
Jamez0r
  • Postovi: 356

Harald

Calling OnPostprocessAllAssets() yourself unfortunately requires some parameters that you don't want to gather yourself:
static void OnPostprocessAllAssets (string[] imported, string[] deleted, string[] moved, string[] movedFromAssetPaths) {
However there is a better solution built-in in Unity: you can simply select the parent directory of the skeleton assets that changed, and select RMB - Refresh or use the shortcut CTRL + R for that. This refreshes only the selected directory and reloads any modified assets, calling OnPostprocessAllAssets() as desired.
Avatar
Harald

Harri
  • Postovi: 3914

Jamez0r

Harald je napisao/la:Calling OnPostprocessAllAssets() yourself unfortunately requires some parameters that you don't want to gather yourself:
static void OnPostprocessAllAssets (string[] imported, string[] deleted, string[] moved, string[] movedFromAssetPaths) {
However there is a better solution built-in in Unity: you can simply select the parent directory of the skeleton assets that changed, and select RMB - Refresh or use the shortcut CTRL + R for that. This refreshes only the selected directory and reloads any modified assets, calling OnPostprocessAllAssets() as desired.
Thanks a lot for that extra info Harald!

Looks like calling AssetDatabase.Refresh() in code is the same thing as the CTRL+R function, except that it refreshes the entire Assets folder, instead of the specific folder you select. But luckily it still only takes about a half-second, so this solution works perfectly!
AssetDatabase.Refresh(); //Refreshes the entire Assets folder, so it processes the new skeleton data
Spine.Unity.Editor.SpineEditorUtilities.ReloadSkeletonDataAssetAndComponent(mySkeletonRenderer); //Reloads the skeleton so it uses the new data
Avatar
Jamez0r
  • Postovi: 356

Harald

Great to hear, thanks for the follow-up info! I admittedly didn't expect it to be that quick, that's even better of course. 8)
Avatar
Harald

Harri
  • Postovi: 3914


Natrag na Unity