Skip to content

Commit

Permalink
Merge pull request EsotericSoftware#432 from Fenrisul/master
Browse files Browse the repository at this point in the history
[Unity] SkeletonAnimator lastTime calculation added to fix skipping
  • Loading branch information
Fenrisul committed Jun 4, 2015
2 parents 0cd14e1 + 1f550ce commit 69e724a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spine-unity/Assets/spine-unity/SkeletonAnimator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public Skeleton Skeleton {

Dictionary<string, Spine.Animation> animationTable = new Dictionary<string, Spine.Animation>();
Animator animator;
float lastTime;

public override void Reset () {
base.Reset();
Expand All @@ -62,7 +63,7 @@ public override void Reset () {

animator = GetComponent<Animator>();


lastTime = Time.time;
}

void Update () {
Expand All @@ -72,12 +73,13 @@ void Update () {
if (layerMixModes.Length != animator.layerCount) {
System.Array.Resize<MixMode>(ref layerMixModes, animator.layerCount);
}
float deltaTime = Time.time - lastTime;

skeleton.Update(Time.deltaTime);

//apply
int layerCount = animator.layerCount;
float deltaTime = Time.deltaTime;

for (int i = 0; i < layerCount; i++) {

float layerWeight = animator.GetLayerWeight(i);
Expand Down Expand Up @@ -183,5 +185,7 @@ void Update () {
if (_UpdateComplete != null) {
_UpdateComplete(this);
}

lastTime = Time.time;
}
}

0 comments on commit 69e724a

Please sign in to comment.