Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

error CS0117: 'AnimationMode' does not contain a definition for 'GetCurveBindings'

Discussion in 'Editor & General Support' started by carlosdaniel369, Nov 15, 2019.

  1. carlosdaniel369

    carlosdaniel369

    Joined:
    Nov 6, 2019
    Posts:
    3
    Library\PackageCache\com.unity.timeline@1.2.6\Runtime\Utilities\AnimatorBindingCache.cs(91,40): error CS0117: 'AnimationMode' does not contain a definition for 'GetCurveBindings'


    Code (CSharp):
    1. #if UNITY_EDITOR
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Playables;
    5. using UnityEngine.Timeline;
    6. using UnityEditor;
    7.  
    8. namespace UnityEngine.Timeline
    9. {
    10.     /// <summary>
    11.     /// Animator to Editor Curve Binding cache. Used to prevent frequent calls to GetAnimatorBindings which can be costly
    12.     /// </summary>
    13.     class AnimatorBindingCache
    14.     {
    15.         public const string TRPlaceHolder = "TransformTR";
    16.         public const string ScalePlaceholder = "TransformScale";
    17.  
    18.         struct AnimatorEntry
    19.         {
    20.             public int animatorID;
    21.             public bool applyRootMotion;
    22.             public bool humanoid;
    23.         }
    24.  
    25.         class AnimatorEntryComparer : IEqualityComparer<AnimatorEntry>
    26.         {
    27.             public bool Equals(AnimatorEntry x, AnimatorEntry y) { return x.animatorID == y.animatorID && x.applyRootMotion == y.applyRootMotion && x.humanoid == y.humanoid; }
    28.             public int GetHashCode(AnimatorEntry obj) { return HashUtility.CombineHash(obj.animatorID, obj.applyRootMotion.GetHashCode(), obj.humanoid.GetHashCode()); }
    29.             public static readonly AnimatorEntryComparer Instance = new AnimatorEntryComparer();
    30.         }
    31.  
    32.         readonly Dictionary<AnimatorEntry, EditorCurveBinding[]> m_AnimatorCache = new Dictionary<AnimatorEntry, EditorCurveBinding[]>(AnimatorEntryComparer.Instance);
    33.         readonly Dictionary<AnimationClip, EditorCurveBinding[]> m_ClipCache = new Dictionary<AnimationClip, EditorCurveBinding[]>();
    34.  
    35.         private static readonly EditorCurveBinding[] kEmptyArray = new EditorCurveBinding[0];
    36.         private static readonly List<EditorCurveBinding> s_BindingScratchPad = new List<EditorCurveBinding>(1000);
    37.  
    38.         public AnimatorBindingCache()
    39.         {
    40.             AnimationUtility.onCurveWasModified += OnCurveWasModified;
    41.         }
    42.  
    43.         public EditorCurveBinding[] GetAnimatorBindings(GameObject gameObject)
    44.         {
    45.             if (gameObject == null)
    46.                 return kEmptyArray;
    47.  
    48.             Animator animator = gameObject.GetComponent<Animator>();
    49.             if (animator == null)
    50.                 return kEmptyArray;
    51.  
    52.             AnimatorEntry entry = new AnimatorEntry()
    53.             {
    54.                 animatorID = animator.GetInstanceID(),
    55.                 applyRootMotion = animator.applyRootMotion,
    56.                 humanoid = animator.isHuman
    57.             };
    58.  
    59.             EditorCurveBinding[] result = null;
    60.             if (m_AnimatorCache.TryGetValue(entry, out result))
    61.                 return result;
    62.  
    63.             s_BindingScratchPad.Clear();
    64.  
    65.             // Replacement for AnimationMode.GetAnimatorBinding - this is faster and allocates kB instead of MB
    66.             var transforms = animator.GetComponentsInChildren<Transform>();
    67.             foreach (var t in transforms)
    68.             {
    69.                 if (animator.IsBoneTransform(t))
    70.                     s_BindingScratchPad.Add(EditorCurveBinding.FloatCurve(AnimationUtility.CalculateTransformPath(t, animator.transform), typeof(Transform), TRPlaceHolder));
    71.             }
    72.  
    73.             var streamBindings = AnimationUtility.GetAnimationStreamBindings(animator.gameObject);
    74.             UpdateTransformBindings(streamBindings);
    75.             s_BindingScratchPad.AddRange(streamBindings);
    76.  
    77.             result = new EditorCurveBinding[s_BindingScratchPad.Count];
    78.             s_BindingScratchPad.CopyTo(result);
    79.             m_AnimatorCache[entry] = result;
    80.             return result;
    81.         }
    82.  
    83.         public EditorCurveBinding[] GetCurveBindings(AnimationClip clip)
    84.         {
    85.             if (clip == null)
    86.                 return kEmptyArray;
    87.  
    88.             EditorCurveBinding[] result;
    89.             if (!m_ClipCache.TryGetValue(clip, out result))
    90.             {
    91.                 result = AnimationMode.GetCurveBindings(clip);
    92.                 UpdateTransformBindings(result);
    93.                 m_ClipCache[clip] = result;
    94.             }
    95.  
    96.             return result;
    97.         }
    98.  
    99.         private static void UpdateTransformBindings(EditorCurveBinding[] bindings)
    100.         {
    101.             for (int i = 0; i < bindings.Length; i++)
    102.             {
    103.                 var binding = bindings[i];
    104.                 if (AnimationPreviewUtilities.IsRootMotion(binding))
    105.                 {
    106.                     binding.type = typeof(Transform);
    107.                     binding.propertyName = TRPlaceHolder;
    108.                 }
    109.                 else if (typeof(Transform).IsAssignableFrom(binding.type) && (binding.propertyName.StartsWith("m_LocalRotation.") || binding.propertyName.StartsWith("m_LocalPosition.")))
    110.                 {
    111.                     binding.propertyName = TRPlaceHolder;
    112.                 }
    113.                 else if (typeof(Transform).IsAssignableFrom(binding.type) && binding.propertyName.StartsWith("m_LocalScale."))
    114.                 {
    115.                     binding.propertyName = ScalePlaceholder;
    116.                 }
    117.                 bindings[i] = binding;
    118.             }
    119.         }
    120.  
    121.         public void Clear()
    122.         {
    123.             m_AnimatorCache.Clear();
    124.             m_ClipCache.Clear();
    125.         }
    126.  
    127.         void OnCurveWasModified(AnimationClip clip, EditorCurveBinding binding, AnimationUtility.CurveModifiedType modification)
    128.         {
    129.             m_ClipCache.Remove(clip);
    130.         }
    131.     }
    132. }
    133. #endif
    134.  
     
  2. alexmelyon

    alexmelyon

    Joined:
    Mar 23, 2018
    Posts:
    2
    Have the same issue
     
  3. kalpana1

    kalpana1

    Joined:
    Mar 5, 2018
    Posts:
    5
    I am trying to open my project (Previous version 2018.1.3f1) in my new computer with Unity version 2019.2.12f1. It'd reporting one error
    "Library\PackageCache\com.unity.timeline@1.3.0-preview.3\Runtime\Utilities\AnimatorBindingCache.cs(91,40): error CS0117: 'AnimationMode' does not contain a definition for 'GetCurveBindings'". Please help me to resolve this error.
     
  4. jmansa

    jmansa

    Joined:
    Apr 13, 2012
    Posts:
    74
    Same issue here.

    Unity version 2019.2.12f1
    MacOS Catalina

    Please help with fix :)
     
    NatalieW15 likes this.
  5. NatalieW15

    NatalieW15

    Joined:
    Jul 30, 2019
    Posts:
    16
    I need an answer for this as well.
     
  6. unity_8PoA3tsV4mDrFw

    unity_8PoA3tsV4mDrFw

    Joined:
    Sep 4, 2019
    Posts:
    3
  7. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
  8. kalpana1

    kalpana1

    Joined:
    Mar 5, 2018
    Posts:
    5
    I resolved my problem by deleting all the similar files of the same project saved in various locations of my computer. I opened the project from downloaded file and it works well with 2019.2.12f1 version now.
     
    Labecki and carlosdaniel369 like this.
  9. noupsovan18

    noupsovan18

    Joined:
    Dec 9, 2019
    Posts:
    2
    Excuse me what are the name of files?
     
  10. noupsovan18

    noupsovan18

    Joined:
    Dec 9, 2019
    Posts:
    2
    All right i think i found the solution. I download 2019.2.12f1 and run old project and got that error:
    1-go to old project folder -> library ->packagecase
    2-open unity hub with new version ->create new project
    3- open new project folder -> library -> packagecase ->ctrl +A
    4-delect all folders in packagecase in old project -> ctrl + v and yeah that will work
    5- you can delece new project if u want
     
    samra2494 likes this.
  11. samra2494

    samra2494

    Joined:
    Nov 23, 2015
    Posts:
    21
    i have open my project in a newer version of unity.. Solved :)
     
    gliealonso likes this.
  12. Dark_Seth

    Dark_Seth

    Joined:
    May 28, 2014
    Posts:
    130
    What version did you use?
     
  13. ImaginationRoom

    ImaginationRoom

    Joined:
    Dec 16, 2019
    Posts:
    1
    I fixed mine by removing the package "com.unity.timeline" from the dependencies listed in [YourProjectFolder]/packages/manifest.json
     
    nawastara, zonayed, ja200920 and 5 others like this.
  14. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    115
    Opening the project with the newest Unity version worked for me
     
    JadenLNW and samra2494 like this.
  15. jerrychrist71

    jerrychrist71

    Joined:
    May 9, 2020
    Posts:
    1
    thanks brother its worked
     
    Vineetatsparana likes this.
  16. Joytrix

    Joytrix

    Joined:
    May 4, 2019
    Posts:
    2
  17. israr987

    israr987

    Joined:
    Dec 15, 2019
    Posts:
    2
    Thanks <3 It Worked
     
  18. ravin5432

    ravin5432

    Joined:
    Aug 26, 2012
    Posts:
    8
    If I remove com.unity.timeline, I get errors for missing reference "Timeline".
    Need a real solution.
     
  19. MelnsVilks

    MelnsVilks

    Joined:
    Oct 20, 2015
    Posts:
    1
    Window => Package manager => find package that error: cs0117 refers to => click Update
    Ps. this type of issue came up after downgrading unity versions on project
     
  20. canijada

    canijada

    Joined:
    Nov 16, 2019
    Posts:
    1
    It really worked! Thank you!!
    Version 2019.2.11f1
     
  21. nawastara

    nawastara

    Joined:
    Sep 12, 2018
    Posts:
    1
    thx my bro it Worked