• Bugs
  • Unity SDK bug in SkeletonMecanim's update

I was just doing some profiling and saw in SkeletonMecanim.MecanimTranslator.Apply() in SkeletonMecanim.cs line 281, it's applying the first clip twice with identical parameters aside from the weight. Is this intentional, or should c be incremented before the break? I added that and haven't noticed any issues, but the speedup is huge.

else { // case MixNext || Hard
                  // Apply first non-zero weighted clip
                  int c = 0;
                  for (; c < clipInfoCount; c++) {
                     var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
                     GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
                     break; // <

---

 c does not increment
                  }
                  // Mix the rest
                  for (; c < clipInfoCount; c++) {
                     var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
                     GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
                  }
Related Discussions
...
  • Изменено