Dharengo / Spriter2UnityDX

Converts Spriter .scml files to Unity prefabs
155 stars 41 forks source link

Many bugs when imported to Unity #10

Open gabrieltva opened 8 years ago

gabrieltva commented 8 years ago

Hi guys,

I am trying to import an animation to Unity, and in the 80% of the cases, it's fail. Why this happen?

Here is an animation on the Spriter Pro, and the same in the Unity, after the import: out-17-2016 13-28-31

In Unity: out-17-2016 13-28-15

Is not only this animation that the problem occurred.

Can you help me?

CarlosHBP commented 7 years ago

This is old, but if anyone have this problem could try insert this at the end of Build method inside AnimationBuilder (Spriter2UnitDX/Editor):

EditorCurveBinding[] curveBindings = AnimationUtility.GetCurveBindings(clip);
AnimationCurve animCurve;
foreach (EditorCurveBinding curveBinding in curveBindings)
{
    if (curveBinding.propertyName != "DisplayedSprite" && curveBinding.propertyName != "m_IsActive")
    {
        animCurve = AnimationUtility.GetEditorCurve(clip, curveBinding);
        for (int i = 0; i < animCurve.length; i++)
        {
            AnimationUtility.SetKeyLeftTangentMode(animCurve, i, AnimationUtility.TangentMode.Linear);
            AnimationUtility.SetKeyRightTangentMode(animCurve, i, AnimationUtility.TangentMode.Linear);
        }
        AnimationUtility.SetEditorCurve(clip, curveBinding, animCurve);
    }
}

That solution was done by @FedericoCara. I just added the "if". You could try to remove it if not work.

TheItCrOw commented 4 years ago

I know this is old but I wanted to thank you anyways. I was not able to use any animationen I made in spriter without practically redoing them in unity after the import crashed so many weird sprite movement. This solution is CRUCIAL and should be added immeadiatly into the repository!

Dharengo commented 4 years ago

Feel free to make a fork and make the change. I haven't supported this thing in ages.