void SamplePose(float time)
        {
            if (sampler == null)
            {
                return;
            }

            if (!AnimationMode.InAnimationMode())
            {
                AnimationMode.StartAnimationMode();
            }

            AnimationMode.BeginSampling();

            try
            {
                // 1. Sample pose
                using (TransformBuffer.Memory pose = sampler.SamplePose(time))
                {
                    // 2. Save bindings so that we can restore the joints to their initial transform once preview is finished
                    foreach (EditorCurveBinding binding in bindings)
                    {
                        AnimationMode.AddEditorCurveBinding(targetObject, binding);
                    }

                    // 3. Sample trajectory
                    AffineTransform rootTransform = sampler.SampleTrajectory(time);
                    if (previousTime >= 0.0f && targetJoints[0] != null)
                    {
                        // If the character was previously animated, we apply delta trajectory to current transform.
                        // Otherwise, we don't move the character (this allows user to move manually previewed character between frames)
                        var currentRootTransform =
                            Missing.Convert(targetObject.transform) *
                            previousRootTransform.inverseTimes(rootTransform);

                        targetJoints[0].position = currentRootTransform.t;
                        targetJoints[0].rotation = currentRootTransform.q;
                    }

                    previousTime          = time;
                    previousRootTransform = rootTransform;

                    // 4. Sample all joints
                    for (int i = 1; i < targetJoints.Length; ++i)
                    {
                        if (targetJoints[i] == null)
                        {
                            continue;
                        }

                        var localJointTransform = pose.Ref.transforms[i];

                        targetJoints[i].localPosition = localJointTransform.t;
                        targetJoints[i].localRotation = localJointTransform.q;
                    }

                    // 5. sample past & future trajectory
                    SampleTrajectory(time);
                }
            }
            finally
            {
                AnimationMode.EndSampling();
            }
        }
        public TransformBuffer.Memory SamplePose(float sampleTimeInSeconds)
        {
            int numJoints = editorAnimation.JointSamplers.Length;

            TransformBuffer.Memory buffer = TransformBuffer.Memory.Allocate(numJoints, Allocator.Temp);
            ref TransformBuffer    pose   = ref buffer.Ref;