Search Unity

Animancer - Less Animator Controller, More Animator Control

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

  1. wb_nizar

    wb_nizar

    Joined:
    Jan 7, 2020
    Posts:
    3
    All good! I appreciate your continued support!
     
  2. Rusted_Games

    Rusted_Games

    Joined:
    Aug 29, 2010
    Posts:
    135
    Hello everyone, perhaps this one was answered before, but the Search doesn't return anything.
    Does Animancer has a way to prevent foot sliding from retargeted animations? with Unity's Animator Controller there's the check to enable Foot IK to solve this scenario.
    Thanks in advance
     
  3. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Animancer has the same Foot IK system as Animator Controllers, it's just activated with code.
     
    Rusted_Games likes this.
  4. DeadReckoned

    DeadReckoned

    Joined:
    Jul 4, 2013
    Posts:
    6
    Hi, I'm attempting to try out Animancer Lite in a project running in Unity 2021.2 beta, however I'm unable to test it with our project to see if it is an appropriate fit. I realise this version of Unity is still in beta (our project is a long way off, so we're trying to stay ahead of the curve).

    Following on from this post: https://forum.unity.com/threads/ani...-animator-control.566452/page-24#post-7504594.

    This error isn't something that will automatically become resolved when it comes out of beta. The method signature for AnimationLayerMixerPlayable.Create() has changed in 2021.2.

    In Unity 2021.1, the method signature is:
    Code (CSharp):
    1. Create(PlayableGraph graph, int inputCount = 0)
    In Unity 2021.2.0b14, the method signature is:
    Code (CSharp):
    1. Create(PlayableGraph graph, int inputCount = 0, bool singleLayerOptimization = true)
    The pre-compiled Animancer Lite DLLs will need to be recompiled to fix this. Until then, it is unfortunately unusable. I understand if you're hesitant to update for beta versions of Unity, so if no fix is coming soon I'll have to stick with regular animator controllers for now.
     
  5. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Yeah, with a default value it won't break regular scripts so it does seem more likely that it won't get reverted.

    Give the attached package a go. It seems to work, but I haven't done any proper testing because it won't let my unit tests compile. For some reason it's not letting scripts in the unit testing assembly definition reference certain parts of Animancer, which does seem like the sort of issue that will be fixed before the final release (but I'll report a bug anyway).
     

    Attached Files:

    DeadReckoned likes this.
  6. DeadReckoned

    DeadReckoned

    Joined:
    Jul 4, 2013
    Posts:
    6
    That appears to be working, thank you for the quick response! The error has disappeared, transition previews are also working.
     
  7. epare025

    epare025

    Joined:
    Oct 9, 2017
    Posts:
    10
    Hey all,
    So far animancer seems great but I've run across a random null reference event and have no idea why. Here is a photo, thanks!. I've been trying to figure out what this message even means but so far no luck, not even sure how to decipher this error log.
     

    Attached Files:

  8. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Looks like the same issue as this bug which is caused by using an Animancer Event (not an End Event) to play a different animation.

    What Unity version are you using? I'll need to recompile Animancer Lite for the appropriate Unity version with the fix in it.

    I'm hoping to officially release a new version in the next few weeks (a minor update), but I'm pretty busy with other stuff at the moment so I don't know how long it will take to finish the things I want to get done for it.
     
  9. epare025

    epare025

    Joined:
    Oct 9, 2017
    Posts:
    10
    I'm using Unity 2021.1.18f1. Love the asset and will be buying soon, thanks for the quick response!
     
  10. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
  11. epare025

    epare025

    Joined:
    Oct 9, 2017
    Posts:
    10
    The Hotfix was able to remove the bug but I just purchased Animancer Pro and the bug is back. I deleted the old animancer folder and installed fresh. Is there a hotfix for pro?
     
  12. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
  13. Grzzld

    Grzzld

    Joined:
    Aug 4, 2014
    Posts:
    12
    Greetings. I have a very basic question that I have been too embarrassed to ask but I so far can't figure it out. How would I fire more than one animation on a key press? I am trying to chain together several different animations depending on the key press (KeyCode.O example below). There will be several scenarios. Many thanks in advance for any advice.


    Code (CSharp):
    1. private void Update()
    2.         {
    3.             if (Input.GetKeyDown("space"))
    4.             {
    5.                 var state = _Animancer.Play(_SpaceAction);
    6.                 state.Events.OnEnd = OnActionEnd;
    7.             }
    8.             else if (Input.GetKeyDown(KeyCode.P))
    9.             {
    10.                 var state = _Animancer.Play(_PAction);
    11.                 state.Events.OnEnd = OnActionEnd;
    12.             }
    13.             else if (Input.GetKeyDown(KeyCode.O))
    14.             {
    15.            
    16.                 var state = _Animancer.Play(_OAction);
    17.                 state = _Animancer.Play(_PAction);
    18.                 state = _Animancer.Play(_SpaceAction);
    19.            
    20.                 state.Events.OnEnd = OnActionEnd;
    21.             }
    22.         }
     
  14. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
  15. Grzzld

    Grzzld

    Joined:
    Aug 4, 2014
    Posts:
    12
    Thank you. I will take a look after dinner. Appreciate the quick response.
     
  16. One_Learning_Man

    One_Learning_Man

    Joined:
    Sep 30, 2021
    Posts:
    81
    Hello Kybernetik, can you help deconstruct Animancer's Finite State Machine to a beginner like me? I'm having trouble understanding what I need, how the process flows, and where things go. I sincerely went through the documentation and still require some assistance. I hope by posting here, other people might benefit.

    I'm using https://app.diagrams.net/ to quickly cobble these diagrams.

    Q1) Is my understanding of the base implementation of FSM and its required component and association correct?
    upload_2021-10-13_22-37-40.png

    In example 6-2 (https://kybernetik.com.au/animancer/docs/examples/fsm/characters/), you introduced a way to streamline this into two main components: Player.cs and PlayerState.cs.
    upload_2021-10-13_22-40-12.png
    Here I begin to get lost where things go and who does what.

    In an example scenario that the player is swimming...

    Q3) Where do I define the specific swimming animation clip?
    Q4) What script captures and stores the state that the player is swimming? Is this ideally PlayerSwim.cs or PlayerStates.cs?
    Q5) What triggers PlayerState.cs to play an animation?

    ----------------------------------

    Q6) How do I use SetAllowNullStates and where do I put it? [Reference: https://kybernetik.com.au/animancer/api/Animancer.FSM/StateMachine_1/AC945B21]
    upload_2021-10-13_22-47-31.png

    Q7) How do I use the .CurrentState property to help me debug and where should I put it? [Reference: https://kybernetik.com.au/animancer/api/Animancer.FSM/StateMachine_1/D09A9E4D]

    upload_2021-10-13_22-48-9.png

    Q8) Sometimes I see "public class PlayerRandomState : State" and "public class PlayerRandomState : StateBehaviour" in practical terms, how do I know when to use State or StateBehavior? (Reference: https://kybernetik.com.au/animancer/docs/manual/fsm/state-types)

    Thank you!
     
  17. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    You might find my Platformer Game Kit helpful since it demonstrates the FSM system in a real world scenario rather than the simplified situations the examples use to demonstrate individual concepts.

    Q1)

    There won't usually be a significant difference between a player and a dog or other character. They would all have an AnimancerComponent for animations, StateMachine for managing their actions, rigidbody for movement, maybe a component to manage their health pool if the game has combat, and so on.

    If that's the case for your game, you likely want something closer to the Character component in the Characters example instead of PlayerGameManagerFSM and DogGameManagerFSM. But either way, those aren't game managers and the FSM suffix was just used by the Game Manager example to differentiate that script from GameManagerEnum.

    Similarly, there is likely no difference in logic between a PlayerRunState and the state used by any other character to run so it should just be called RunState. When you add it to the player, you give it the player's Run animation in the Inspector and if you add it to a dog or NPC or whatever else you give it their appropriate animation, but the actual logic isn't specific to the player in any way.

    I'm not really sure what you think PlayerRun needs to do separately from PlayerRunState.

    Q3)

    You would have a SwimState script with an animation field to assign in the Inspector and override the state's OnStateEnter method to play that animation.

    Or if the only difference between running and swimming is the animation, then you could merge them into MovementState and just assign the appropriate animation to each.

    Q4)

    The whole purpose of a StateMachine is to keep track of which state it's in, so anything with a reference to the script holding the StateMachine can check its CurrentState.

    Q5)

    PlayerStates doesn't play animations. SwimState plays its animation when entered. RunState plays its animation when entered. Etc.

    Q6)

    Any script with access to a StateMachine can call SetAllowNullStates() on it. Usually you'd do that in the script that creates the new StateMachine. So in that GameManagerFSM script you could just add an Awake method and have it call StateMachine.SetAllowNullStates().

    Q7)

    When do you actually want that debug line to run? If you want it to run on startup, put it in an Awake method. If you want it to run every frame, put it in an Update method. Etc.

    Q8)

    If you want your states to be components that you attach to GameObjects, you can inherit from StateBehaviour. Otherwise you can just inherit from State or implement the IState interface directly.

    Many of those were basic programming questions, so I'd recommend doing some tutorials on the basics of programming first. I've tried to make my examples and documentation as easy to understand as possible, but teaching you how to code really isn't my responsibility.
     
  18. ogglynator

    ogglynator

    Joined:
    May 2, 2014
    Posts:
    12
    Does anyone know how you can get the keyframe animation window to show in Unity without activating a native Unity Animator Controller? Currently I only use Animancer for animations, but I still need to keep the Animator-controller around in order to edit the keyframes. If I remove the Animator I only get something to show in the animation window when selecting the objects in Play Mode. It would be great to be able to edit the animation in edit mode.
     
  19. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Having an AnimancerComponent on the same object as the Animator should allow the Animation window to get its animations from Animancer while you have that object selected. And Animancer will just give it any animations it can find in components in its parents and children.

    If it's not working, can you post a screenshot showing the Hierarchy, Inspector, and Animation window with the object that has the Animator component selected?
     
  20. ogglynator

    ogglynator

    Joined:
    May 2, 2014
    Posts:
    12
    Ok! Now it seems to work! So as long as I add animations as public variables on components in the vicinity of the AnimancerComponent, they will get picked up?

    Is there any documentation on how/where Animancer collects the animations?
     
  21. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
  22. ogglynator

    ogglynator

    Joined:
    May 2, 2014
    Posts:
    12
    Wonderful! Great summary! Thank you!
     
  23. Grzzld

    Grzzld

    Joined:
    Aug 4, 2014
    Posts:
    12
    This was exactly what I was looking for, many thanks!
     
  24. One_Learning_Man

    One_Learning_Man

    Joined:
    Sep 30, 2021
    Posts:
    81


    Having never worked with State Machines, I finally think it clicked for me. Traditionally and normally, one would always think of the object first and work with it:

    upload_2021-10-14_22-2-2.png

    But in working with state machines, you have to adopt a completely different perspective, from the action itself.

    upload_2021-10-14_22-4-42.png

    Now I see what you mean by both no difference in run and a run state AND also how it spans across units/creatures making it reusable.

    Thank you very much for your patience and help.
     
    Kybernetik likes this.
  25. unity_05B59064C1E7A73BFCFC

    unity_05B59064C1E7A73BFCFC

    Joined:
    Sep 1, 2021
    Posts:
    5
    Currently evaluating Animancer Lite and enjoying it very much!

    There's this one annoyance though that I'd like to fix, which is that Omnisharp is throwing an error when I attempt to use the "code actions" feature to automatically fix issues with the code in the editor.

    It turns out that the
    Animancer/Internal/Core/Animancer.Lite.dll
    file is the cause of this error.

    Does anyone know how to fix/workaround this issue?

    Here's the error:

    Code (Boo):
    1. OmniSharp.Extensions.JsonRpc.InputHandler: Failed to handle request textDocument/codeAction 39870 - System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
    2. Could not load file or assembly 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
    3. Could not load file or assembly 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
    4. Could not load file or assembly 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
    5. Could not load file or assembly 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
    6. Could not load file or assembly 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
    7. Could not load file or assembly 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
    8. Could not load file or assembly 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
    9. Could not load file or assembly 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
    10.   at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
    11.   at System.Reflection.Assembly.GetTypes () [0x00000] in <533173d24dae460899d2b10975534bb0>:0
    12.   at System.Reflection.Assembly+<get_DefinedTypes>d__127.MoveNext () [0x0001e] in <533173d24dae460899d2b10975534bb0>:0
    13.   at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x0006f] in <5b415632df1f4365ae2242b1a257bb5b>:0
    14.   at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in <5b415632df1f4365ae2242b1a257bb5b>:0
    15.   at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].MoveNext () [0x0004e] in <5b415632df1f4365ae2242b1a257bb5b>:0
    16.   at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x0003d] in <5b415632df1f4365ae2242b1a257bb5b>:0
    17.   at System.Collections.Generic.SparseArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x00000] in <5b415632df1f4365ae2242b1a257bb5b>:0
    18.   at System.Collections.Generic.SparseArrayBuilder`1[T].ReserveOrAdd (System.Collections.Generic.IEnumerable`1[T] items) [0x00017] in <5b415632df1f4365ae2242b1a257bb5b>:0
    19.   at System.Linq.Enumerable+Concat2Iterator`1[TSource].ToArray () [0x00015] in <5b415632df1f4365ae2242b1a257bb5b>:0
    20.   at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <5b415632df1f4365ae2242b1a257bb5b>:0
    21.   at System.Collections.Immutable.ImmutableArray.CreateRange[T] (System.Collections.Generic.IEnumerable`1[T] items) [0x0004d] in <be358f84962848a48784e4a9d001abe1>:0
    22.   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[TSource] (System.Collections.Generic.IEnumerable`1[T] items) [0x0000f] in <be358f84962848a48784e4a9d001abe1>:0
    23.   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.LoadFrom (Microsoft.CodeAnalysis.Project project) [0x000d5] in <b2c506b357334f00a79b9ea4b4ad8eef>:0
    24.   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects.GetAllCodeFixesForProject (Microsoft.CodeAnalysis.ProjectId projectId) [0x00045] in <b2c506b357334f00a79b9ea4b4ad8eef>:0
    25.   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].GetSortedCodeFixProviders (Microsoft.CodeAnalysis.Document document) [0x00011] in <b2c506b357334f00a79b9ea4b4ad8eef>:0
    26.   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].AppendFixesAsync (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Generic.IEnumerable`1[T] diagnostics, System.Collections.Generic.List`1[T] codeActions) [0x0003e] in <b2c506b357334f00a79b9ea4b4ad8eef>:0
    27.   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].CollectCodeFixesActions (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Generic.List`1[T] codeActions) [0x001c1] in <b2c506b357334f00a79b9ea4b4ad8eef>:0
    28.   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService`2[TRequest,TResponse].GetAvailableCodeActions (OmniSharp.Models.V2.CodeActions.ICodeActionRequest request) [0x001a4] in <b2c506b357334f00a79b9ea4b4ad8eef>:0
    29.   at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.GetCodeActionsService.Handle (OmniSharp.Models.V2.CodeActions.GetCodeActionsRequest request) [0x0006b] in <b2c506b357334f00a79b9ea4b4ad8eef>:0
    30.   at OmniSharp.LanguageServerProtocol.Handlers.OmniSharpCodeActionHandler.Handle (OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeActionParams request, System.Threading.CancellationToken cancellationToken) [0x000de] in <20d9883430cc4d61bacb55dfe24e759b>:0
    31.   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, MediatR.RequestHandlerDelegate`1[TResponse] next) [0x0031e] in <a65ee41ef84f44d8810b866724a97eec>:0
    32.   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, MediatR.RequestHandlerDelegate`1[TResponse] next) [0x00077] in <a65ee41ef84f44d8810b866724a97eec>:0
    33.   at MediatR.Pipeline.RequestPreProcessorBehavior`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, MediatR.RequestHandlerDelegate`1[TResponse] next) [0x0013e] in <856ae299ee314304bc3affd17d8d5868>:0
    34.   at MediatR.Pipeline.RequestPostProcessorBehavior`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, MediatR.RequestHandlerDelegate`1[TResponse] next) [0x0007e] in <856ae299ee314304bc3affd17d8d5868>:0
    35.   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, MediatR.RequestHandlerDelegate`1[TResponse] next) [0x00084] in <856ae299ee314304bc3affd17d8d5868>:0
    36.   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, MediatR.RequestHandlerDelegate`1[TResponse] next) [0x00276] in <856ae299ee314304bc3affd17d8d5868>:0
    37.   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, MediatR.RequestHandlerDelegate`1[TResponse] next) [0x00084] in <856ae299ee314304bc3affd17d8d5868>:0
    38.   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, MediatR.RequestHandlerDelegate`1[TResponse] next) [0x001e7] in <856ae299ee314304bc3affd17d8d5868>:0
    39.   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1[TDescriptor].<RouteRequest>g__InnerRoute|5_0 (Microsoft.Extensions.DependencyInjection.IServiceScopeFactory serviceScopeFactory, OmniSharp.Extensions.JsonRpc.Server.Request request, TDescriptor descriptor, System.Object params, System.Threading.CancellationToken token, Microsoft.Extensions.Logging.ILogger logger) [0x000fc] in <f52078c2a67749cdb3fc490a4675d4eb>:0
    40.   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1[TDescriptor].RouteRequest (OmniSharp.Extensions.JsonRpc.IRequestDescriptor`1[TDescriptor] descriptors, OmniSharp.Extensions.JsonRpc.Server.Request request, System.Threading.CancellationToken token) [0x0049f] in <f52078c2a67749cdb3fc490a4675d4eb>:0
    41.   at OmniSharp.Extensions.JsonRpc.InputHandler+<>c__DisplayClass38_0.<RouteRequest>b__5 (System.Threading.CancellationToken ct) [0x000f2] in <f52078c2a67749cdb3fc490a4675d4eb>:0
     
  26. mm_hohu

    mm_hohu

    Joined:
    Jun 4, 2021
    Posts:
    41
    @Kybernetik

    Thanks for your great assets.
    By the way, I have a question. I would like to know how to correctly instantiate the ClipTransition with AnimationClip using code without inspector.

    I tried to write the following, but please correct me if I am wrong.
    Code (CSharp):
    1.  
    2. ClipTransition InstantiateClipTransition(AnimancerComponent a,AnimationClip c)
    3.         {
    4.             // The following code is insufficient to instantiace clip transition, right?
    5.             var t = new ClipTransition
    6.             {
    7.                 Clip = c,
    8.                 SerializedEvents = new AnimancerEvent.Sequence.Serializable()
    9.             };
    10.             t.SerializedEvents.SetNormalizedEndTime(1f);
    11.             t.CreateStateAndApply(a.Playable);
    12.             return t;
    13.  
    14.         }
    15.  
     
  27. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    CreateStateAndApply will give an error, but that's easily fixed by double clicking it to open the script and changing the
    var callbackCount = _Callbacks.Length;
    to
    var callbackCount = _Callbacks != null ? _Callbacks.Length : 0;


    I'm aiming to release a small update sometime soon, which will include that fix.
     
  28. mm_hohu

    mm_hohu

    Joined:
    Jun 4, 2021
    Posts:
    41
    Thanks for your reply.

    What you are talking about is line 141 of the AnimationEvent.Sequence.Serializable.cs file, right?

    And once that fix is released, will the above code work fine?
     
  29. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Yes to both questions.
     
    mm_hohu likes this.
  30. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    ratking and mm_hohu like this.
  31. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    @unity_05B59064C1E7A73BFCFC Sorry I missed your post last week.

    I have no idea what might be causing the issue and the stack trace isn't going through any Animancer code so there's no way for me to debug it. I recommend reporting a bug to the Omnisharp developers.

    Edit: did I actually miss your post or was it only posted a couple of minutes ago? It says it was posted on Friday, but I only just got a notification email about it which shouldn't be possible since I've obviously visited the thread since then.
     
  32. ace7171363

    ace7171363

    Joined:
    Sep 19, 2021
    Posts:
    3
    I am having a problem playing Directional attack animation as Input.GetkeyDown only plays the starting frames of my animation but when when i use Input.GetKey and hold the button it works fine.
    Code (CSharp):
    1. {
    2.             var attack = Input.GetKeyDown(KeyCode.Mouse0);
    3.             if(attack)
    4.             {
    5.                 play(_Attack);
    6.                 return;
    7.                
    8.             }
    9.             else
    10.             play( _Idle);
    11.            
    12.            
    13.          
    14.         }
    15.  
    16. //Play method
    17.  
    18. void play(DirectionalAnimationSet animations)
    19.     {
    20.         _MovementSynchronisation.StoreTime(_CurrentAnimationSet);
    21.  
    22.         _CurrentAnimationSet = animations;
    23.         _Animancer.Play(animations.GetClip(_Facing));
    24.         _MovementSynchronisation.SyncTime(_CurrentAnimationSet);
    25.     }
     
  33. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    GetKeyDown returns true for one frame. So you're telling it to play _Attack, then next frame you're telling it to play _Idle again.

    I recommend going through the State Machines examples to properly manage your actions and the ways they can interrupt each other.
     
  34. ge01f

    ge01f

    Joined:
    Nov 28, 2014
    Posts:
    121
    @Kybernetik I tried upgrading my Animancer from 6.x to 7.x and it looks like the UI is broken. After updating my code to reference `MixerTransition2D` instead of `MixerState.Transition2D` there is no longer a way to add animations.

    The only Editor plugin I know that may be messing with it is Odin Inspector, but Im not doing any markup on the inspector information for that class, or its parent class.

    In that C# file, Odin Inspector isnt even used. Its just sitting inside a ScriptableObject container to capture N transitions and bundle them together.

    Is it normal that the Directional animation section and the +- buttons are gone now? I have to downgrade back to 6.x.

    animancer_broken.PNG
     
  35. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Yeah, it's a bug in the way Odin picks which drawer to use for a field. This page explains how you can disable Odin for a field. And I reported a bug to them so if you leave a comment to let them know you're experiencing the same issue that might get them to prioritise it more. Otherwise if you don't need anything from Animancer v7 you could roll back to v6 which had a very different structure for the transition classes (explained in the Upgrade Guide).
     
    hopeful likes this.
  36. determi_love

    determi_love

    Joined:
    Jan 4, 2021
    Posts:
    7
    If I don’t want to set the loop time to true in the animation itself, but set it in the script: As long as the method where animancer.play is located does not stop being called by other conditions, the animation will return to 0 when it reaches 1 and continue to play ( Loop playback), how can I achieve it?

    like:
    Code (CSharp):
    1. void Update()
    2. {
    3.  if (blablabla)
    4.   {
    5.   playAnim();
    6.   }
    7.  else
    8.  {
    9.   //nothing
    10.  }
    11. }
    12.  
    13. void playAnim()
    14. {
    15.  animancer.Play(a_clip);
    16.  //a_clip will play in a loop, but loop time is not set to true.
    17.  //Until the playAnim() is no longer called by the if conditional in Update.
    18. }
    After reading the documentation, I found that if you want to use animancer to achieve this, you might have to use "AnimancerEvent.Events.OnEnd"? But I don't understand this part very well...
     
  37. ge01f

    ge01f

    Joined:
    Nov 28, 2014
    Posts:
    121
    I watched and voted on it. Hopefully they will fix. Thanks for the work around.

    Yeah, the transitions did seem to change significantly. Since I couldnt see the result, Im not sure if I dislike them enough to avoid upgrading to keep my current implementation. But for now, thanks for the work around on it!

    I'll check back in later and see if I need other features you are making to do the upgrade. I definitely like the simple way Transition2D works in 6.x, but I'm sure you had good reasons to change it.
     
  38. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
  39. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    350
    Seems like Odin's new version fixed the Inspector issue with LinearMixerTransition and so on.

    Screenshot_2.jpg
     
    Kybernetik likes this.
  40. techniquea2z

    techniquea2z

    Joined:
    Jun 3, 2017
    Posts:
    37
    Quick question: I often get warnings in my console saying that an OnEnd event has not really ended the animation.

    I have a method that takes an Action to be invoked upon `animState.Events,OnEnd`. I'd really hate to manually put Mecanim events and make Animancer listeners every time I want to get the end of an animation.

    Code (CSharp):
    1.  
    2.             if (!_Animancer.IsPlayingClip(directionalClip))
    3.             {
    4.                 _isPlayingExtraAnimation = true;
    5.  
    6.                 _animState = _Animancer.Play(directionalClip);
    7.  
    8.                 _animState.Events.OnEnd += delegate ()
    9.                {
    10.                    if (!loop)
    11.                        _isPlayingExtraAnimation = false;
    12.                
    13.                    onAnimationEnd?.Invoke();
    14.                };
    15.             }
    Am I using it wrong, perhaps? The onEnd event is really handy, using it with DirectionalAnimationSets, I'd rather not use mecanim events just for the animation's end, if I can avoid it.
     
  41. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    If your onAnimationEnd delegate doesn't actually play another animation, you'll get that warning. But as it says, it's just detecting a potential bug so if it's doing exactly what you want you can just disable the warning.

    Note that end events are triggered every frame after the specified time has passed so if you don't want that, you can just use a regular Animancer Event: _animState.Events.Add(1, delegate ... instead.
     
  42. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    Looks great, just adding +1 wish for easy networking integration
    (like example scripts for photon or mlapi would be nice, even as a separate paid asset would work)
     
  43. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    mgear likes this.
  44. Sixoul

    Sixoul

    Joined:
    Jan 9, 2014
    Posts:
    20
    I just purchased Animancer and was wondering how to integrate it into my current character setup. I have a characterController that holds a FSM. The states within the FSM decide what animations to play, I was having issues with using blend trees with the AnimatorController Unity provides. Could I store animations in a SO and an AnimancerComponent on the characterController then call animations from the current state via those?
     
  45. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    You certainly can do that. Animancer has no way of knowing where your script got an animation from so you can structure things however you like.
     
    Sixoul likes this.
  46. Kamil_80

    Kamil_80

    Joined:
    Aug 17, 2015
    Posts:
    5
    I am using custom IPC curves from animations. I was doing that by adding parameters in the animator and then I was able to get values in code by Animator.GetFloat("Speed"). How can I do the same using the Animancer?

     
  47. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
  48. Kamil_80

    Kamil_80

    Joined:
    Aug 17, 2015
    Posts:
    5
    Thanks for the quick answer!
     
  49. GoldFireStudios

    GoldFireStudios

    Joined:
    Nov 21, 2018
    Posts:
    160
    As I understand it, the next layer in the list should override the previous if set to "override." However, I'm getting some strange behavior when applying a full body animation to an override layer with a Hybrid Animancer Component. Does it work differently with the hybrid component? In the video below, you can see that the legs are folded up into the character unless I set the weight of the Base Layer to 0, even though the Base Layer should be 100% overridden.

     
  50. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    I bought Animancer Pro (thank you:) and I deleted Animancer-lite.dll because I try not to have any DLLs in my project. The samples seem to work fine so im just confirming is it OK that I delete that animator-lite.dll?