• Unity
  • How to force the RELOAD button at runtime

  • Изменено
Related Discussions
...

UPDATE Unity fixed itself somehow after restarting the editor. :angry: :angry: :angry: :angry: UPDATE

Hi Harald

How can I force this reload button during runtime?

I tried all of these, but the skin doesn't update during runtime :wounded:


 _skeletonMecanimUI = GameObject.Find("Character").GetComponent<SkeletonMecanim>();

 _skeletonMecanimUI.skeleton.SetSkin("dog");

_skeletonMecanimUI.skeleton.SetSlotsToSetupPose();
_skeletonMecanimUI.skeleton.SetToSetupPose();
_skeletonMecanimUI.skeleton.SetBonesToSetupPose();

I tried to clear the skin before setSkin, but no luck either

_skeletonMecanimUI.skeleton.Skin.Clear();

<br>
I was looking through this thread

http://en.esotericsoftware.com/forum/SkeletonDataAsset-Reload-9225

SpineEditorUtilities.ReloadSkeletonDataAssetAndComponent(_skeletonMecanimUI)

This doesn't do anything either :think:

If I manually press the Reload button in the editor, the skin changes fine

I tried to look through the SkeletonMecanim.cs file, but couldn't find the actual Reload function

I've udpated to spine-unity 4.0 (updated 2022-02-10, changelog)
Compatible with Spine 4.0.00 or newer and Unity 2017.1-2021.1.

Thanks for the help!

Sorry to hear you were having troubles. Did I understand your update correctly that it's now working again as desired? It is strange that pressing the Reload button had a different effect than calling ReloadSkeletonDataAssetAndComponent. Are you sure that your script changes were actually compiled and updated the game or editor? I'm asking because sometimes Unity fails to detect any code file modifications and does not rebuild anything, ignoring all the changes you make. You can quickly test that by introducing a compile error in your script, if that's not reflected in the Log window then you know it's not built. Restarting Unity then resolves this issue.

Another question: did you receive any error or warning messages in the Log window? If so, please always post the complete error messages, including the stack trace.