UnityGLTF
UnityGLTF copied to clipboard
Optimize animation import
Improves upon three things:
- Do tangent calculation operations on keyframe cached array rather than AnimationCurve. This is the most important change. Unity profiler shows that accessing AnimationCurve.keys is a costly operation.
- Optimizes branching by moving if..else outside loop. The compiler probably already does this but it's nice to do it ourselves.
- Fixes a bug when two incoming animation keys have the same time value. I don't know if this is valid per gltf specs but I faced this using some models downloaded from Sketchfab.
Just saw that there's another PR that includes first point from this: #479
Thank you for contributing the change! @AdamMitchell-ms can you review?