Harald đã viếtSorry to hear you're facing troubles. I'm afraid the posted code will not be sufficient to help, as we do not know from where you are calling the Void GetArt()
method. BTW: Did you introduce an alias for void
with an uppercase-V, or did you just paste pseudo-code here?
Also, are the GameObjects active from the beginning, are they a fixed part of a scene or instantiated?
Hi Harald
sorry for the delay. finally got around to trying to fix this again. It's more or less the code, but cleaned up the variable names so it's easier to read.
GetArt()
is called in Update() when the canvas is enabled. So the canvas check is
void Update ()
{
if (_player.GetButtonDown(StatsPage))
{
if (canvas.enabled)
{
GetArt();
}
}
}
I just noticed .. I cannot get validation on:
if (_skeletonGraphic.IsValid)
When I do a ...
print(_skeletonGraphic.IsValid)
... I get a return of FALSE.
So when I dug in a bit deeper into the code I found Spine was looking for Skeleton
protected Skeleton skeleton;
public Skeleton Skeleton {
get {
Initialize(false);
return skeleton;
}
set {
skeleton = value;
}
}
public SkeletonData SkeletonData { get { return skeleton == null ? null : skeleton.data; } }
public bool IsValid { get { return skeleton != null; } }
Am I missing something here? Is the SkeletonDataAsset supposed to be the SkeletonData?
I've commented out these lines and the animations are playing again.. but inconsistently.. still the animation is stuck at the T Pose certain times. :think:
//if (_skeletonGraphic.IsValid)
{
_skeletonGraphic.Skeleton.SetSkin("Classic");
//_skeletonGraphic.Skeleton.SetSlotsToSetupPose();
_skeletonGraphic.AnimationState.SetAnimation(0, Expression.Idle.ToString(), true);
//_skeletonGraphic.Update(0);
}
Thanks for your help :wounded: