Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Unity 5 compatibility
  • Loading branch information
Alaa-eddine committed Feb 22, 2015
1 parent cf1d909 commit 07e38b2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Expand Up @@ -102,8 +102,12 @@ public AnimationClip MakeAnimationClip(GameObject root, Animation animation, str
var animClip = new AnimationClip();
animClip.name = animation.Name;

#if UNITY_5
//Not needed in Unity 5 ??
#else
//Set clip to Generic type
AnimationUtility.SetAnimationType(animClip, ModelImporterAnimationType.Generic);
#endif

//Populate the animation curves & events
MakeAnimationCurves(root, animClip, animation);
Expand Down
Expand Up @@ -123,7 +123,11 @@ static void ImportScml(string assetPath)
{
if (animationClip)
{
AnimatorController.AddAnimationClipToController(controller, animationClip);
#if UNITY_5
controller.AddMotion(animationClip);
#else
AnimatorController.AddAnimationClipToController(controller, animationClip);
#endif
}
}
}
Expand Down
Expand Up @@ -190,8 +190,13 @@ public static void SetAnimationSettings(this AnimationClip animClip, AnimationCl
{
//Use reflection to get the internal method
BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.NonPublic;
#if UNITY_5
BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.NonPublic;
AnimationUtility.SetAnimationClipSettings(animClip, settings);
#else
MethodInfo mInfo = typeof(AnimationUtility).GetMethod("SetAnimationClipSettings", bindingFlags);
mInfo.Invoke(null, new object[] { animClip, settings });
#endif
}
}
}
Expand Down

0 comments on commit 07e38b2

Please sign in to comment.