Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set FPS to animation clip which is autogenerated by skeleton mecanim #2395

Open
wants to merge 1 commit into
base: 4.1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ public static void GenerateMecanimAnimationClips (SkeletonDataAsset skeletonData
}
}

SkeletonData skeletonData = skeletonDataAsset.GetSkeletonData(true);

foreach (Animation animations in data.Animations) {
string animationName = animations.Name; // Review for unsafe names. Requires runtime implementation too.
spineAnimationTable.Add(animationName, animations);
Expand All @@ -144,6 +146,7 @@ public static void GenerateMecanimAnimationClips (SkeletonDataAsset skeletonData
}

AnimationClip clip = unityAnimationClipTable[animationName];
clip.frameRate = skeletonData.Fps;
clip.SetCurve("", typeof(GameObject), "dummy", AnimationCurve.Linear(0, 0, animations.Duration, 0));
AnimationClipSettings settings = AnimationUtility.GetAnimationClipSettings(clip);
settings.stopTime = animations.Duration;
Expand Down