YoungBong

hi.
i have poor english.

soldier walk NorthWest <-> NorthEast by input(keyboard).

call the following code method whenever change direction.
skeletonAnimation.skeleton.SetToSetupPose();
skeletonAnimation.state.ClearTracks();
1. one soldier : no problem
2. clone soldier in runtime : have problem.
sometimes flickering occurs but first soldier not flicker.
perhaps showing the first frame momentarily.
if (GUILayout.Button("Clone Soldier"))
{
GameObject go = Instantiate(prefabSoldier);
float x = Random.Range(-1.5f, 1.5f);
float y = Random.Range(-1.5f, 1.5f);
go.transform.position = new Vector3(x, y, 0);

SkeletonAnimation skeletonAnimation = go.GetComponent<SkeletonAnimation>();

skeletonAnimation.skeleton.UpdateCache();
skeletonAnimation.skeleton.UpdateWorldTransform();
skeletonAnimation.skeleton.SetToSetupPose();
}
this is problem video.
YoungBong
  • Postovi: 1

Pharan

skeletonAnimation.skeleton.SetToSetupPose();
skeletonAnimation.state.ClearTracks();
This part is a clear culprit of the flicker.
It's not wrong in all cases, but is there a reason why you are calling ClearTracks?

Spine animation logic happens in Update, and mesh generation (pre-render) happens in LateUpdate.
One of the causes of flickering like this is if you modify the skeleton between those two things.

How to get rid of the flickering, depends on when and how you're setting new animations.
Can we see that part?
Avatar
Pharan
  • Postovi: 5366


Natrag na Unity