KybernetikGames / animancer

Documentation for the Animancer Unity Plugin.
63 stars 8 forks source link

TypeLoadException: Could not load list of method overrides due to Could not resolve type with token 01000056 from typeref #333

Closed cdr9042 closed 5 months ago

cdr9042 commented 5 months ago

Environment

Description

I have a project originally created in Unity 2021.3.14. I upgraded Unity to 2022.3.19.

Unity asks me: Unity will update some Unity functions in some compiled dll, including Animancer. I accept.

When I run the game in Editor, I get exception when I call the method animancer.Play(hintAnim).Time = 0;

Reproduction

Steps to reproduce the bug:

  1. Script
[SerializeField] private AnimancerComponent animancer;

public void ToggleHintAnim(bool value)
        {
            if (value)
            {
                animancer.Play(hintAnim).Time = 0;
            }
            else { animancer.Stop(hintAnim); }
        }
  1. Call the method
  2. Error:
    TypeLoadException: Could not load list of method overrides due to Could not resolve type with token 01000056 from typeref (expected class 'System.Object' in assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') assembly:System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.Object member:(null)
    Animancer.AnimancerComponent.InitializePlayable () (at Assets/Plugins/Animancer/AnimancerComponent.cs:314)
    Animancer.AnimancerComponent.get_Playable () (at Assets/Plugins/Animancer/AnimancerComponent.cs:77)
    Animancer.AnimancerComponent.Play (UnityEngine.AnimationClip clip) (at Assets/Plugins/Animancer/AnimancerComponent.cs:471)
    JacatGames.GoodsSort.MatchableRenderer.ToggleHintAnim (System.Boolean value) (at Assets/_Project/Scripts/GameSort/MatchableRenderer.cs:69)
KybernetikGames commented 5 months ago

I've managed to replicate the issue and I'll look into it ASAP.

In the meantime, try deleting and reimporting Animancer then telling Unity not to update the DLLs. I'm sure that means something won't work, but the quick test I did seemed to at least be usable.

KybernetikGames commented 5 months ago

I missed where you said you updated from an earlier version of Unity.

Whenever you do that, you need to delete Animancer and re-download it in the Package Manager so that it gets the appropriate version of Animancer for that Unity version, then you can Import it again. That doesn't apply to Animancer Pro, only Lite because it contains pre-compiled DLLs.

cdr9042 commented 5 months ago

Re-importing Animancer fixed the issue, thank you.

Later I got this error when building in iOS, I've fixed it by setting Code stripping level to minimal. I'll leave the error message here for future reference when other people run into it in Unity 2022.

related issue https://github.com/KybernetikGames/animancer/issues/278

Building Library/Bee/artifacts/iOS/AsyncPluginsFromLinker failed with output:
UnityEditor.Build.BuildFailedException: Burst compiler (1.8.12) failed running

stdout:
Overriding backend due to platform constraints : 'burst-llvm-10'
Error: Failed to find entry-points:
System.Exception: Unexpected exception while processing type `Animancer.AnimatedBool/Job` ---> System.Exception: The type `UnityEngine.Animations.ProcessAnimationJobStruct`1<Animancer.AnimatedBool/Job>` does not contain an `Execute` method
  at Burst.Compiler.IL.Server.EntryPointMethodFinder.FindEntryPoints (System.String[] rootAssemblyNames, Burst.Compiler.IL.Hashing.CacheRuntime.HashCacheAssemblyStore assemblyStore, Burst.Compiler.IL.AssemblyLoader assemblyLoader, Burst.Compiler.IL.NativeCompilerOptions options, Burst.Compiler.IL.Server.ProfileDelegate profileCallback, System.Boolean includeRootAssemblyReferences, System.Boolean splitTargets) [0x007b2] in <f26dfc19a37a442ea317a7ab78395fa6>:0