| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 
 | void Apply(GameObject g){
 List<AnimationClip> animationClipList = new List<AnimationClip>(AnimationUtility.GetAnimationClips(g));
 if (animationClipList.Count == 0) {
 AnimationClip[] objectList = UnityEngine.Object.FindObjectsOfType (typeof(AnimationClip)) as AnimationClip[];
 animationClipList.AddRange(objectList);
 }
 
 int count = 0;
 
 foreach (AnimationClip theAnimation in animationClipList)
 {
 foreach (AnimationClipCurveData theCurve in AnimationUtility.GetAllCurves(theAnimation))
 {
 string name = theCurve.propertyName.ToLower();
 if (name.Contains("scale"))
 {
 for (int i = theCurve.curve.keys.Length - 1; i >= 0; i--) {
 theCurve.curve.RemoveKey(i);
 }
 string propertyName = theCurve.propertyName;
 // we can't delete "*.x", e.g. m_LocalScale.x - but only "*", e.g. m_LocalScale
 if (propertyName.IndexOf(".") > 0) {
 propertyName = propertyName.Substring(0, propertyName.IndexOf("."));
 }
 Debug.Log(string.Format("Fixing: {0} - {1}", theCurve.path, propertyName));
 theAnimation.SetCurve(theCurve.path, theCurve.type, propertyName, null);
 count++;
 }
 }
 }
 
 int checkCount = 0;
 foreach (AnimationClip theAnimation in animationClipList)
 {
 foreach (AnimationClipCurveData theCurve in AnimationUtility.GetAllCurves(theAnimation))
 {
 string name = theCurve.propertyName.ToLower();
 if (name.Contains("scale"))
 {
 checkCount++;
 }
 }
 }
 
 if (count > 0)
 {
 Debug.Log("Total number of removed curves is " + count + ". GO name: " + g.name);
 Debug.Log("Number of remaining scale curves is " + checkCount);
 }
 }
 
 |