calaverax

Hello Everyone!

I know, its not recommended to change the skeleton in runtime... but i have a popup with several changing animations, and i need to set those animation from addressables.

I having a tough time trying to achieve this... when i change the skeletonDataAsset i got an error with the skin, the skeleton still try to acess the previous skin even when i'm setting the new skin right away.
Any hints on this would be really appreciated!
SpineSkeletonGraphic.Clear();

SpineSkeletonGraphic.skeletonDataAsset = skeleton;

SpineSkeletonGraphic.Initialize(true);

// Setup Animation / Skin
SpineSkeletonGraphic.Skeleton.SetSkin(narrator.Skin);
SpineSkeletonGraphic.AnimationState.SetAnimation(0, narrator.Animation, true);
У вас нет необходимых прав для просмотра вложений в этом сообщении.
calaverax
  • Сообщения: 2

Harald

You have to set initialSkinName, otherwise it will be a remainder of the previously set skin name that is causing an error during Initialize(), looking for the old skin name.

In the case of SkeletonGraphic, you also have to be sure to update the MaskableGraphic part via SetMaterialDirty().

The relevant code is as follows:
skeletonGraphic.initialSkinName = "goblin";
skeletonGraphic.startingAnimation = "";

skeletonGraphic.Initialize(true);

skeletonGraphic.AnimationState.SetAnimation(0, "walk", true);
skeletonGraphic.SetMaterialDirty();
Аватара пользователя
Harald

Harri
  • Сообщения: 1105

calaverax

Thanks! ill try with this !
calaverax
  • Сообщения: 2


Вернуться в Runtimes