Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Animancer - Less Animator Controller, More Animator Control

Discussion in 'Assets and Asset Store' started by Kybernetik, Oct 8, 2018.

  1. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Yes, it will always run the full algorithm. Mainly because I never thought about it.

    Giving it an early out would technically cause different behaviour because if you're exactly on a threshold and there's another one very close by, that other one might end up with non-zero weight due to the way the algorithm works.

    It would also mean the worse case performance (running the whole algorithm) is a bit worse because you're also checking for equality, but the overall average performance would likely be higher since being at (0,0) or a cardinal direction if using a keyboard is quite common.

    So it's probably worth implementing, but I'd add a static bool to disable it just in case. I'll put it on my to do list for the next version.
     
  2. F4t1h

    F4t1h

    Joined:
    Nov 12, 2017
    Posts:
    15
    Hey there, I recently updated my project from 7.3 to 7.4.2 and having issues with initializing my mixers I can't solve.
    On the changes page I found that .initialize() doesn't exist anymore, so I changed the code to the new method.
    However after playing with new code, it throws null reference exceptions. I only changed initialization code.

    Before
    Code (CSharp):
    1. BaseJumpMixer = new LinearMixerState();
    2. BaseJumpMixer.Initialize(cs[0].jumpLoop, cs[0].jumpStart);
    3. BaseJumpMixer.SetThresholds(-10, 2);
    After
    Code (CSharp):
    1. BaseJumpMixer = new LinearMixerState();
    2. BaseJumpMixer.Add(cs[0].jumpLoop, -10);
    3. BaseJumpMixer.Add(cs[0].jumpStart, 2);
    Also Animancer Component says that playable is not initialized, and the console throws 70 plus warnings with "possible bug found"

    Thanks a lot in advance

     
  3. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Your "After" code looks correct and shouldn't be the source of your problem.

    You need to start by looking at the first error in the logs because it's most likely causing some or all of the other errors and warnings. The stack trace will tell you which line it's coming from in which script and you can put in some Debug.Logs to figure out what's null. For example, maybe one of the animation clips you're putting in the mixer is null.

    Don't bother looking at the warnings until you've fixed the errors.
     
    F4t1h likes this.
  4. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,653
    Hello I installed the pro version of the plugin and unity is prompting for files updates

    upload_2023-2-13_12-17-58.png

    is this expected?
     
  5. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    It's fine to just click yes.

    Both of those files have a
    #if UNITY_2022_2_OR_NEWER
    to avoid the need for Unity to show that dialogue, but I might have missed the exact version where the change was made.

    Which version of Unity are you using?
     
  6. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,653
    hello do you mind pointing out an example of how to use AnimancerEditorUtilities.SetLooping? Specifically we are not sure which asset is going to touch and we need then to save back.
     
  7. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    It's a method with two parameters: an AnimationClip and a bool to indicate if you want it looping or not. The asset it's going to touch is obviously the clip you pass in. I'm all for giving detailed examples, but needing one for something that simple is a bit extreme.
     
  8. wubuzi

    wubuzi

    Joined:
    Jan 19, 2022
    Posts:
    9
    Hi.
    I update to 7.4.2 now, and My MixerTransition2D is having issue.
    Now, my code does not work anymore.
    How to change MixerTransition2D animations? I modify the Animations Array, no use, animation do not change in game.
    Code (CSharp):
    1.  
    2. public MixerState<Vector2> blendState;
    3.  
    4. public MixerTransition2D blend;
    5.  
    6. List<ClipTransition> list = new List<ClipTransition>()
    7. {
    8.             newAnimation1,
    9.             newAnimation2,
    10.             newAnimation3,
    11.             newAnimation4
    12. };
    13.  
    14. for (int i = 0; i < 4; i++)
    15. {
    16.             blend.Animations[i] = list[i].Clip;
    17. }
    18.  
    19.  
    20. blendState = animancer.States.GetOrCreate(blend) as MixerState<Vector2>;
    21. animancer.Play(blendState, 0.0f);
    22.  
    23. //MixerTransition2D still same as last one!!
    24. //This code can not change the animations!
     
    Last edited: Feb 14, 2023
  9. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    A transition won't recreate or restructure the mixer state after it's already created. That behaviour wasn't changed in v7.4, it has always worked like that.

    If you want to modify the mixer state, you can use
    blendState.Set / Remove / Add
    or
    blendState.GetChild(i).Clip = list[i].Clip;
    .
     
  10. wubuzi

    wubuzi

    Joined:
    Jan 19, 2022
    Posts:
    9
    Thank you! It works!

    I highly recommend making an example of this feature to help people like me who rely on example learning to get a better grasp of it, as blending animation is a common requirement when changing in code.
     
  11. jenkins22

    jenkins22

    Joined:
    Nov 15, 2014
    Posts:
    10
    I'm having trouble seamlessly transitioning from a DirectionalMixerState to an AnimationClip, and then quickly back to the same DirecitonalMixerState. I'm following the Brain / FSM setup, with a MoveState that has the directional mixer and an IdleState that has the idle animation clip.

    The following example illustrates the problem:

    Code (CSharp):
    1. IEnumerator ExampleReproCoroutine() {
    2.     // Simulate the player strafing left (FSM is in MoveState).
    3.     _directionalMixerState.SetParameter(Vector2.Left);
    4.     _animancer.play(_directionalMixerState, 0.5f);
    5.  
    6.     // Simulate the player releasing the Strafe Left key (FSM goes to IdleState)...
    7.     yield return new WaitForSeconds(2f);
    8.     _animancer.play(_idleClip, 0.5f);
    9.  
    10.     // ...and then immediately pressing the Strafe Right key, before the cross-fade finishes (FSM goes back to MoveState).
    11.     yield return new WaitForSeconds(0.3f);
    12.     _directionalMixerState.SetParameter(Vector2.Right);
    13.     _animancer.play(_directionalMixerState, 0.5f);
    14. }
    The issue is that during the 2nd transition, the cross-fade of the 1st transition hasn't completed, so the DirectionalMixerState still has a non-zero weight. Because of this, changing the mixer parameter causes the character to instantly snap to a new pose.

    If I Lerp / MoveTowards the new param instead of setting it immediately, the pose snapping is gone, but the transition looks bad: the character goes from leaning left (strafing left) to being almost upright (cross-fading to the Idle pose), but then starts leaning left again as the mixer's X parameter starts going from -1 to 0, and then finally starts leaning right towards its final pose as the mixer's X parameter goes from 0 to 1. This back & forth body movement on each direction change isn't great.

    I think what I want to do is to essentially change the param of a non-zero-weight mixer without affecting the final pose, which I know is contradictory. Is there a way to somehow "detach" the current pose into a "new" temporary state? Then I'd be able to change the mixer param and simply
    Animancer.Play()
    it with a cross-fade.

    (This could probably be solved by merging the IdleState into the MoveState and adding the Idle clip in the mixer at [0,0], but I'd like to keep the IdleState and MoveState separate.)
     
  12. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
  13. demimonde

    demimonde

    Joined:
    May 3, 2021
    Posts:
    27
    I keep getting an "AssertionException: Node is not fading (FadeSpeed is 0)." All I'm doing is playing and setting a custom fade for a LinearMixerTransition. I only get the error when I play the same transition that was last played, so when there isn't anything to animate/fade. Should this really throw an error? I'm fine with checking if whatever state I'm about to play will actually have an effect and then just NOT play it, to prevent the error, but I haven't discovered a way to do that.
     
    Ony likes this.
  14. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    That exception is just there to help explain how to use the system properly. Changing it to this should let it still do that without getting in your way if the thing you just played was already at full weight:
    Code (CSharp):
    1. AnimancerUtilities.Assert(node.TargetWeight == 1 || node.TargetWeight > node.Weight, "Node is not fading in.");
     
  15. demimonde

    demimonde

    Joined:
    May 3, 2021
    Posts:
    27
    Thank you! Appreciate the quick reply. But how am I using the system "improperly" then? Sometimes transitions can be triggered even if they are already at full weight, that's the nature of a dynamic state system and unpredictable player input. Instead of changing that line I would prefer to simply check if the transition should play at all. Is that not possible?
     
    Ony likes this.
  16. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    You aren't using the system improperly. What I had in mind when writing the assertion was if you tried to just start a CustomFade on its own when there wouldn't be a regular fade for it to steal the time from, but I didn't consider the case where you actually did try to start a regular fade and it was skipped for being unnecessary. So I'll be changing the assertion in the next version of Animancer.

    If you want to check if the transition should play at all, you could use
    animancerComponent.States.TryGet(key, out var state);
    and check its Weight and TargetWeight. But just telling it to play will already essentially do that internally so you wouldn't be gaining much by doing so (and if the transition is necessary then the check would be performed twice - by your code and then again internally).
     
    Ony likes this.
  17. demimonde

    demimonde

    Joined:
    May 3, 2021
    Posts:
    27
    Alright, thanks! Appreciate the explanation. That makes sense!
     
  18. demimonde

    demimonde

    Joined:
    May 3, 2021
    Posts:
    27
    On another note, if I want the equivalent of nested blend trees, I would have to use Scriptable Objects/Asset Transitions, so they can be assigned to other transitions, right?
     
  19. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
  20. hugo-purespark

    hugo-purespark

    Joined:
    Oct 29, 2022
    Posts:
    18
    Hi. Using the IK Puppet example in a VR application. I would like the player to grab the model's hand rather than the spheres to position the model. Like a clothing designer would a mannequin.

    How would I do this using animancer?
     
  21. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    You could just turn off the MeshRenderer components on the spheres.
     
  22. demimonde

    demimonde

    Joined:
    May 3, 2021
    Posts:
    27
    Thank you! Exactly what I needed. Got it to work with that example.

    By the way, I keep getting these two null refs related to the assembly thrown on compile:
    Failed to find entry-points:
    Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Animancer.Lite, Version=7.4.2.25, Culture=neutral, PublicKeyToken=null'
    at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at zzzUnity.Burst.CodeGen.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00039] in <a2dd15248a25411e914af2a2c82fb63f>:0
    at Burst.Compiler.IL.AssemblyLoader.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00079] in <a2dd15248a25411e914af2a2c82fb63f>:0
    at Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type) [0x00038] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type) [0x00006] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.TypeReference.Resolve () [0x00006] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.Mixin.CheckedResolve (Mono.Cecil.TypeReference self) [0x00000] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.SignatureReader.ReadCustomAttributeEnum (Mono.Cecil.TypeReference enum_type) [0x00000] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.SignatureReader.ReadCustomAttributeElementValue (Mono.Cecil.TypeReference type) [0x0002f] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.SignatureReader.ReadCustomAttributeElement (Mono.Cecil.TypeReference type) [0x00015] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.SignatureReader.ReadCustomAttributeFixedArgument (Mono.Cecil.TypeReference type) [0x00015] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.SignatureReader.ReadCustomAttributeConstructorArguments (Mono.Cecil.CustomAttribute attribute, Mono.Collections.Generic.Collection`1[T] parameters) [0x0002e] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.MetadataReader.ReadCustomAttributeSignature (Mono.Cecil.CustomAttribute attribute) [0x0003c] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.CustomAttribute.<Resolve>b__35_0 (Mono.Cecil.CustomAttribute attribute, Mono.Cecil.MetadataReader reader) [0x00000] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ModuleDefinition.Read[TItem,TRet] (TItem item, System.Func`3[T1,T2,TResult] read) [0x00025] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.CustomAttribute.Resolve () [0x00033] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.CustomAttribute.get_ConstructorArguments () [0x00000] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.ReadCustomAttributes (Mono.Cecil.ICustomAttributeProvider provider) [0x00024] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.ReadFields (Mono.Cecil.TypeDefinition type) [0x00065] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.ReadType (Mono.Cecil.TypeDefinition type) [0x0004a] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.ReadTypes (Mono.Collections.Generic.Collection`1[T] types) [0x0000c] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.ReadModule (Mono.Cecil.ModuleDefinition module, System.Boolean resolve_attributes) [0x0004f] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.<ReadModule>b__2_0 (Mono.Cecil.ModuleDefinition module, Mono.Cecil.MetadataReader reader) [0x00007] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ModuleDefinition.Read[TItem,TRet] (TItem item, System.Func`3[T1,T2,TResult] read) [0x00025] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.ReadModule () [0x00000] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ModuleReader.CreateModule (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x0007b] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ModuleDefinition.ReadModule (Mono.Disposable`1[T] stream, System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000d] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0006c] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.BaseAssemblyResolver.GetAssembly (System.String file, Mono.Cecil.ReaderParameters parameters) [0x0000f] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.BaseAssemblyResolver.SearchDirectory (Mono.Cecil.AssemblyNameReference name, System.Collections.Generic.IEnumerable`1[T] directories, Mono.Cecil.ReaderParameters parameters) [0x00073] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x0000c] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at zzzUnity.Burst.CodeGen.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00039] in <a2dd15248a25411e914af2a2c82fb63f>:0
    at Burst.Compiler.IL.AssemblyLoader.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00079] in <a2dd15248a25411e914af2a2c82fb63f>:0
    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, Burst.Compiler.IL.Helpers.DebugLogWriter debugWriter) [0x00055] in <a2dd15248a25411e914af2a2c82fb63f>:0
    at Burst.Compiler.IL.Server.FindMethodsJob.Execute (Burst.Compiler.IL.Server.CompilerServerJobExecutionContext context) [0x00133] in <a2dd15248a25411e914af2a2c82fb63f>:0

    While compiling job:

    Failed to find entry-points:
    System.Exception: Unexpected exception while collecting types in assembly `Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null` ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Animancer.Lite, Version=7.4.2.25, Culture=neutral, PublicKeyToken=null'
    at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at zzzUnity.Burst.CodeGen.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00039] in <a2dd15248a25411e914af2a2c82fb63f>:0
    at Burst.Compiler.IL.AssemblyLoader.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00079] in <a2dd15248a25411e914af2a2c82fb63f>:0
    at Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type) [0x00038] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type) [0x00006] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.TypeReference.Resolve () [0x00006] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.Mixin.CheckedResolve (Mono.Cecil.TypeReference self) [0x00000] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.SignatureReader.ReadCustomAttributeEnum (Mono.Cecil.TypeReference enum_type) [0x00000] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.SignatureReader.ReadCustomAttributeElementValue (Mono.Cecil.TypeReference type) [0x0002f] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.SignatureReader.ReadCustomAttributeElement (Mono.Cecil.TypeReference type) [0x00015] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.SignatureReader.ReadCustomAttributeFixedArgument (Mono.Cecil.TypeReference type) [0x00015] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.SignatureReader.ReadCustomAttributeConstructorArguments (Mono.Cecil.CustomAttribute attribute, Mono.Collections.Generic.Collection`1[T] parameters) [0x0002e] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.MetadataReader.ReadCustomAttributeSignature (Mono.Cecil.CustomAttribute attribute) [0x0003c] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.CustomAttribute.<Resolve>b__35_0 (Mono.Cecil.CustomAttribute attribute, Mono.Cecil.MetadataReader reader) [0x00000] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ModuleDefinition.Read[TItem,TRet] (TItem item, System.Func`3[T1,T2,TResult] read) [0x00025] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.CustomAttribute.Resolve () [0x00033] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.CustomAttribute.get_ConstructorArguments () [0x00000] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.ReadCustomAttributes (Mono.Cecil.ICustomAttributeProvider provider) [0x00024] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.ReadFields (Mono.Cecil.TypeDefinition type) [0x00065] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.ReadType (Mono.Cecil.TypeDefinition type) [0x0004a] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.ReadTypes (Mono.Collections.Generic.Collection`1[T] types) [0x0000c] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.ReadModule (Mono.Cecil.ModuleDefinition module, System.Boolean resolve_attributes) [0x0004f] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.<ReadModule>b__2_0 (Mono.Cecil.ModuleDefinition module, Mono.Cecil.MetadataReader reader) [0x00007] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ModuleDefinition.Read[TItem,TRet] (TItem item, System.Func`3[T1,T2,TResult] read) [0x00025] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ImmediateModuleReader.ReadModule () [0x00000] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ModuleReader.CreateModule (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x0007b] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ModuleDefinition.ReadModule (Mono.Disposable`1[T] stream, System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000d] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0006c] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.BaseAssemblyResolver.GetAssembly (System.String file, Mono.Cecil.ReaderParameters parameters) [0x0000f] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.BaseAssemblyResolver.SearchDirectory (Mono.Cecil.AssemblyNameReference name, System.Collections.Generic.IEnumerable`1[T] directories, Mono.Cecil.ReaderParameters parameters) [0x00073] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x0000c] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at zzzUnity.Burst.CodeGen.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00039] in <a2dd15248a25411e914af2a2c82fb63f>:0
    at Burst.Compiler.IL.AssemblyLoader.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00079] in <a2dd15248a25411e914af2a2c82fb63f>:0
    at Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type) [0x00038] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type) [0x00006] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Mono.Cecil.TypeReference.Resolve () [0x00006] in <ebb9e4250ed24cbfa42055e3532ef311>:0
    at Burst.Compiler.IL.Server.EntryPointMethodFinder.CollectGenericTypeInstances (Mono.Cecil.TypeReference type, System.Collections.Generic.List`1[T] types, System.Collections.Generic.HashSet`1[T] visited) [0x0002f] in <a2dd15248a25411e914af2a2c82fb63f>:0
    at Burst.Compiler.IL.Server.EntryPointMethodFinder.CollectGenericTypeInstances (Mono.Cecil.AssemblyDefinition assembly, System.Collections.Generic.List`1[T] types, System.Collections.Generic.HashSet`1[T] visited) [0x00057] in <a2dd15248a25411e914af2a2c82fb63f>:0
    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, Burst.Compiler.IL.Helpers.DebugLogWriter debugWriter) [0x0019d] in <a2dd15248a25411e914af2a2c82fb63f>:0
    --- End of inner exception stack trace ---
    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, Burst.Compiler.IL.Helpers.DebugLogWriter debugWriter) [0x001d9] in <a2dd15248a25411e914af2a2c82fb63f>:0
    at Burst.Compiler.IL.Server.FindMethodsJob.Execute (Burst.Compiler.IL.Server.CompilerServerJobExecutionContext context) [0x00133] in <a2dd15248a25411e914af2a2c82fb63f>:0

    While compiling job:
     
  23. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Looks like Burst is scanning through all assemblies to look for jobs to compile and doesn't properly handle what it's finding in Animancer.Lite.dll.

    What version of Unity are you using and is that Animancer Lite or Pro?
     
  24. demimonde

    demimonde

    Joined:
    May 3, 2021
    Posts:
    27
    I'm on 2021.3.17. Currently I'm using Lite. I literally just got it two days ago to test whether it's right for us. We will inevitably upgrade to Pro though... it's really a fantastic asset!
     
  25. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Damn, if you were using Pro it would be an easy fix because the DLL is an empty dummy so it would just mean their system doesn't handle empty DLLs and I could just add something to it. But in Animancer Lite that DLL contains all the internal code and Burst likely has a problem with the obfuscation system which would be much trickier to fix. I'll look into it.
     
  26. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    I'm not getting any errors in a new project with just Animancer and Burst. Are you able to replicate the issue in a new project? Is there anything else you need to do to get the errors other than just recompiling scripts?
     
  27. hugo-purespark

    hugo-purespark

    Joined:
    Oct 29, 2022
    Posts:
    18
    Yes, but unlike the body sphere, the other spheres can be moved away from the model. If they could act like the body sphere and stick to the hand or feet position then this would be an option.
     
  28. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    You could use a simple script to have the targets follow the bones in LateUpdate:
    Code (CSharp):
    1. public sealed class FollowTransform : MonoBehaviour
    2. {
    3.     [SerializeField] private Transform _Follow;
    4.  
    5.     private void LateUpdate()
    6.     {
    7.         transform.position = _Follow.position;
    8.     }
    9. }
    Just attach that to each of the hand and foot targets and give them the corresponding bone.
     
  29. hugo-purespark

    hugo-purespark

    Joined:
    Oct 29, 2022
    Posts:
    18
    Thanks will try.
     
  30. demimonde

    demimonde

    Joined:
    May 3, 2021
    Posts:
    27
    After restarting Unity, the issue disappeared! Weird!

    By the way, is there an obvious way to do animation posterization/fps decimation with Animancer? Or do you have a suggestion on how to do this?
     
  31. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
  32. demimonde

    demimonde

    Joined:
    May 3, 2021
    Posts:
    27
    Ah, I think I was unclear. I'm simply looking for a way to reduce the framerate for animation playback, transitions etc.
     
  33. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    The Update Rate example demonstrates how you can have Animancer update at a different rate.
     
    demimonde likes this.
  34. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,653
    Very likely I am missing something but I want to ask here to have more information:

    with legacy AnimationClip, a not looped animation stops automatically
    with Animancer, it seems that instead it holds the last frame and I have to stop the animation explicitly.

    intended behaviour or am I missing some settings?
     
  35. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    That's correct. The Legacy animation system had a WrapMode enum with a bunch of different options for that, but non-legacy animations only have a single
    isLooping
    bool and will either Loop or Clamp based on that. That behaviour is part of the underlying Playables API so there's nothing Animancer can do about it.

    If you want something other than those two options, you can use End Events to do whatever you want when the animation ends.
     
    sebas77 likes this.
  36. brokenspiralstudios

    brokenspiralstudios

    Joined:
    Oct 20, 2021
    Posts:
    45
    I have used your ``inputBuffer.Buffer(_state, _inputTimeOut)`` to successfully change states but is it possible to somehow use the inputBuffer between different Abilities? I'm looking for the same effect of the player attacks and presses attack again during the 1st attack, then when the 1st attack is complete - trigger the attack again. Here is my current implementation. Thanks again!

    Code (CSharp):
    1. public class MeleeAbility : Ability {
    2.  
    3.         private Player _player;
    4.         private IMelee _ability;
    5.         private IInput _input;
    6.  
    7.         public MeleeAbility(Player player, IMelee ability, IInput input) {
    8.             _player = player;
    9.             _ability = ability;
    10.             _input = input;
    11.             _input.OnMelee += TryAbility;
    12.         }
    13.  
    14.         public override void TryAbility() {
    15.             _ability.Perform();
    16.         }
     
  37. ArcticStagMedia

    ArcticStagMedia

    Joined:
    Aug 21, 2020
    Posts:
    5
    Hey, So I'm having some difficulties getting Animancer Lite up and running. I imported Animancer into my project and went into my Player Controller script where I added
    using Anumancer;
    When I do this I get the following error
    Code (CSharp):
    1. The type or namespace name 'Animancer' could not be found (are you missing a using directive or an assembly reference?) [Assembly-CSharp.Player] csharp(CS0246)
    I'm not sure what I'm doing wrong here and a google search of the error didn't really help.

    Any assistance would be greatly appreciated
     
  38. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    @brokenspiralstudios InputBuffers only work on states and I'd generally make all my abilities as states, but if you don't want to do that you could always just make a copy of the InputBuffer class and it should be pretty straightforward to replace its trying to enter a state with trying to use an ability.

    @ArcticStagMedia Is your Player Controller script under an Assembly Definition? If so, you'll need to go to the Assembly Definition and add a reference to the Animancer assembly.

    Otherwise, are you able to replicate the issue if you import Animancer into a new project and make a new script?
     
  39. brokenspiralstudios

    brokenspiralstudios

    Joined:
    Oct 20, 2021
    Posts:
    45
    So the reason why I changed some things to Abilities instead of keeping everything as states was due to some conflicts. For example, FreeMoveState, JumpState, DashState, MeleeState, and then there's LockedOnState. When the player went into LockedOnState, then moved into JumpState, they would lose the lock. What LockedOnState does differently than MoveState is the player circles around and faces the target the entire time. To make this work entirely with states instead of abilities how would I go about doing this without repeating a ton of code? Basically I want FreeMoveState and LockedOnState to have the same possible "Abilities" but states like DamagedState would not because when damaged the player should not be able to do anything for a moment. There were a few other similar conflicting moments with other states but I think you get the idea. Thanks!
     
  40. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Unless you're trying to do something really unusual, it makes no sense to try to implement lock on as a state in your main state machine. The Brains example uses a CharacterParameters class to have things like the desired movement direction in a central place where any state can access it and for most games it would make sense to also put the lock on system there. The brain can set the parameter when you lock or unlock and the move state can react accordingly.
     
  41. brokenspiralstudios

    brokenspiralstudios

    Joined:
    Oct 20, 2021
    Posts:
    45
    ok that is making sense about the Lock and Unlock. Now in the case of a MoveState and a JumpState - let's say I want to be able to still move around in the JumpState. Does that mean I have to repeat the move logic in MoveState in JumpState?
     
  42. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    If the logic can be implemented as a static function, just do that so you can call it from both places. Otherwise, you can either give the JumpState a reference to the MoveState so it can access whatever it needs or put the shared logic somewhere referenced by the Character so both states can access it through there.
     
  43. brokenspiralstudios

    brokenspiralstudios

    Joined:
    Oct 20, 2021
    Posts:
    45
    Do you know why this code is triggering multiples in the Animancer Component? If so, how would I prevent?

    Screenshot:
    https://imgur.com/a/4iZxmaJ

    Code (CSharp):
    1.  
    2. private void Update() {
    3.             HandleMovement();
    4. }
    5.  
    6. private void HandleMovement() {
    7.             if (!_character.Parameters.CanMove() || _character.Parameters.IsAttacking) return;
    8.          
    9.             ClipTransition moveAnim = null;
    10.             if (_itemInHand != null) {
    11.                 moveAnim = _character.Parameters.CanRun()
    12.                     ? _itemInHand.Run
    13.                     : _itemInHand.Walk;
    14.             }
    15.             else {
    16.                 moveAnim = _character.Parameters.CanRun()
    17.                     ? _run
    18.                     : _walk;
    19.             }
    20.             PlayBase(moveAnim, false, AnimationType.Movement);
    21.         }
     
  44. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    289
    Hi bros, anyone used Dynamic Joint Chain Pro with Animancer yet?
    I have problem with it, animation is very shaky with this dynamic asset.

    I thought changing the Script Execution Order to later than Animancer would solve the issue, but it's not the case.
     
  45. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
  46. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    289
    Even shakier.
    It's so unfortunate, the asset has very cool Hinge and Angle Limit for joint and many cool procedural animation features, but seems like don't ever take into account animation.
     
  47. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    I'd recommend contacting the Dynamic Joint Chain Pro developer about it. It would be quite surprising if they had developed that whole system without considering traditional animations.
     
    Spikebor likes this.
  48. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    289
    They gone MIA since first release in June 2022 lol, nearly 1 year ago. That's why my only last resort is asking around in community ^^
    upload_2023-3-5_11-22-24.png
     
  49. brokenspiralstudios

    brokenspiralstudios

    Joined:
    Oct 20, 2021
    Posts:
    45
    ok so yes clicking off Start Time fixed the duplicates but then created a different problem. Stepping sounds no longer trigger on each step. In the Walk and Run animation clips, I setup Events where the stepping sound should happen which calls the Footstep function
    Code (CSharp):
    1. public void Footstep(AnimationEvent evt) {
    2.             if (evt.animatorClipInfo.weight < 0.1f) return;
    3.  
    4.             AudioManager.Instance.PlayOneShot(_character.Parameters.CanRun()
    5.                 ? _runSfx
    6.                 : _walkSfx, transform.position);
    7.         }
     
  50. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Start Time being ticked or unticked has no connection to Animation Events so there must be something else wrong with your setup.