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. Dismiss Notice

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,486
    Yes, that's correct. And I wouldn't recommend making one unless you have a significant amount of time to invest.

    A simple solution would be to zero your speed whenever you are in a non-locomotion state like an attack so that it always accelerates from there when entering the locomotion state. But the main reason I didn't touch it is because some character controller systems I've seen already have their own inbuilt acceleration system so using one of them would solve this issue too.
     
    Last edited: Mar 13, 2022
    One_Learning_Man likes this.
  2. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,681
    @Kybernetik Hi there,
    I want to monitor the time (assuming 0-1) that the animation playing, is at. How can I get this value?

    Thank you!
     
  3. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    The States page lists various ways of getting a state.

    Then you can just get and set the state's NormalizedTime.
     
  4. HypnoT0ad

    HypnoT0ad

    Joined:
    Jul 18, 2019
    Posts:
    2
    Hi,

    I'm having a problem getting an OnEnd event to fire. I'm using modified code from the example, but I can't figure out why it won't fire.



    Code (CSharp):
    1.        
    2. public AnimancerState PerformActionLayered(ClipTransition Clip)
    3.         {
    4.                 var state = _LayeredAnimancer.Layers[ActionLayer].Play(Clip, _FadeDuration, FadeMode.FromStart);
    5.                 state.Events.OnEnd = () =>
    6.                 {
    7.                     Debug.Log("OnEnd Activated");
    8.                     state.Layer.StartFade(0, _FadeDuration);
    9.                 };
    10.                 return state;
    11.         }
    The animation fires, but gets stuck in the last frame. What might be the problem?

    Thanks!
     
  5. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    I can't see anything wrong with that code so something else must be interfering with it. Try making a minimal reproduction project to reproduce the issue with a minimal amount of scripts. Most likely that will help you find the issue, but otherwise if you send the project to animancer@kybernetik.com.au I'll be happy to take a look at it for you.
     
  6. Beloudest

    Beloudest

    Joined:
    Mar 13, 2015
    Posts:
    245
    Hi I've been using your FineControl script for quite some time but for some reason unknown to me I can not add any other namespaces to the script so I can reference another component in the project from the script. This particular namespace works everywhere else in the project except on Animancer scripts. The script seems to be able to find all the Unity namespaces but no others. How do you suggest calling another namespace from the script or enabling adding 3rd party namespaces to Animancer.Examples.FineControl? thanks
     
  7. HypnoT0ad

    HypnoT0ad

    Joined:
    Jul 18, 2019
    Posts:
    2
    I figured it out. I was overwriting the OnEnd event in another area. Thanks for responding!
     
  8. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    @Beloudest The Examples folder has an Assembly Definition file which controls what references are available to scripts in its sub folders.

    So you could put the other scripts you want to reference in an Assembly Definition and then add it as a reference in the Animancer.Examples Assembly Definition.

    But I would recommend just making a copy of whatever example scripts you want (Ctrl + D) and moving them out with the rest of your code. That way if you update to a newer version of Animancer that changes the example you're using it won't change your copy of the script (and the update I'm currently working on does change many of the examples).
     
    Beloudest likes this.
  9. abhin7993

    abhin7993

    Joined:
    Aug 23, 2019
    Posts:
    7
    Hi,
    I am using Animancer Lite version in the starting and also made a project on this, but i faced the issue which is the speed of animation is getting fast at the Runtime Build, so i purchaged the Animancer Pro version, now also i m not able to adjust the speed of my animation, Can anyone suggest that how we can do it.

    I am new to unity, so any help will be greatly appreciated.

    I am also not using the Animator Controller, where as i am selecting my animation (what is to be played next) from my script only and animation data taken from the Resources folder.
     
  10. abhin7993

    abhin7993

    Joined:
    Aug 23, 2019
    Posts:
    7
    Yes, but the next animation is played before the first animation gets fully end(some frames are left in it).
     
  11. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    Speed in Animancer Lite Runtime Builds should always be locked to the default 1. There shouldn't be any way to make it go faster because it's a Pro-Only feature.
    You can control the speed like this:
    Code (CSharp):
    1. var state = animancer.Play(clip);
    2. state.Speed = ...
    The Spider Bot and Doors examples both show it in action.
    The next animation plays when your code tells it to play. If that's too early, then you need to look at whatever is triggering your code. Player input? Events? Something else? I can't really help without seeing any of your code.
     
  12. abhin7993

    abhin7993

    Joined:
    Aug 23, 2019
    Posts:
    7
    @Kybernetik, Thank You for your reply, as you have told about the speed of animation, so i am able to change the speed of animation in my Inspector window from script, but no change i can see in the build file when i build the project and then run it.

    this image contains a Green tick which shows that my speed is changed from the script,
    here we are also having speed which i pointed by Red tick, is there any way that i can access it through the script?
     

    Attached Files:

    • pic2.png
      pic2.png
      File size:
      39.2 KB
      Views:
      218
  13. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    The overall speed where your red tick is can be accessed using
    animancerComponent.Playable.Speed
    .

    If you have Animancer Pro and your speed controls aren't working in Runtime Builds, please send a minimal reproduction project to animancer@kybernetik.com.au so I can take a look at it.
     
  14. abhin7993

    abhin7993

    Joined:
    Aug 23, 2019
    Posts:
    7
    @Kybernetik, thanks for your reply,

    With your above suggestion i am able to control the speed in Runtime during Play,
    pic6.png
    The script changes that i made, is this line
    pic5.png

    After that i have prepared the Standalone build file for this project
    pic7.png

    pic8.png

    When i am running this application, the changes which i made in the project for the speed of animation(0.3f) could not be seen. And here application is running at a very fast speed than normal.

    I have already purchased Animancer Pro,
    Could you please help me in this?
     
  15. John_Leorid

    John_Leorid

    Joined:
    Nov 5, 2012
    Posts:
    625
    First off: I am very happy with animancer so far, playing an animation from another script is extremely easy and awesome.

    Now to my question: I have a "LinearMixerTransitionAsset" which I want to load from the resources folder and then play.
    I can't use the LinearMixerTransitionAsset.UnShared inspector drawer to set things up for me. How to setup things manually? (State and Events, I guess)
     
  16. Beloudest

    Beloudest

    Joined:
    Mar 13, 2015
    Posts:
    245
    Thank you, I had a deadline and didnt want to break anything but yes in future will do that. It's good to know the solution.
     
  17. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    @Hannibal_Leo You could just set the
    unShared.Asset = theTransitionAssetYouLoadedFromResources
    . Then you can play the unShared like any other.

    Or you could get and store the state yourself. Something like this:
    Code (CSharp):
    1. private AnimancerComponent _Animancer;
    2. private LinearMixerTransitionAsset _TransitionAsset;
    3. private LinearMixerState _MixerState;
    4.  
    5. private void Awake()
    6. {
    7.     _TransitionAsset = Resources.Load ...
    8.     _MixerState = (LinearMixerState)_Animancer.States.GetOrCreate(_TransitionAsset);
    9. }
    10.  
    11. private void PlayMixer()
    12. {
    13.     _Animancer.Play(_TransitionAsset);
    14. }
    15.  
    16. private void SetParameter(float value)
    17. {
    18.     _MixerState.Parameter = value;
    19. }
     
    John_Leorid likes this.
  18. John_Leorid

    John_Leorid

    Joined:
    Nov 5, 2012
    Posts:
    625
    Overlooked that one xD Awesome, thanks a lot ^^
     
  19. techniquea2z

    techniquea2z

    Joined:
    Jun 3, 2017
    Posts:
    37
    @Kybernetik I'm having an issue with built-in Animation Events... they do not fire when played by the AnimancerComponent.

    I'm using Animancer + DirectionAnimationSets.

    Typically, I've been using the code listeners for hybrid events with built-in animation events:


    Code (CSharp):
    1. private void BeganJumping(AnimationEvent animationEvent) {
    2.         _OnBeganJumping.SetFunctionName("BeganJumping");
    3.         _OnBeganJumping.HandleEvent(animationEvent);
    4.     }
    5.  
    6.     private Action<AnimationEvent> TriggerJumpingState() {
    7.         return delegate (AnimationEvent animationEvent) {
    8.             jumping = true;
    9.         };
    10.     }
    The AnimationEvent would call BeganJumping with the AnimaionClip as a parameter.

    But, I'm trying to setup SFX animation events with string params that tell the code which SFX to play.

    Is it possible to pass both the animation clip and a string param in a code event?

    Honestly, the ideal solution would be built-in events firing as expected, though. Does Animancer support that? If so, what am I missing that causes mine to go ignored?

    EDIT: NVM -- figured it out.


    Code (CSharp):
    1. private void PlaySFXClip(AnimationEvent animationEvent)
    2.     {
    3.         _PlaySFXClip.SetFunctionName("PlaySFXClip");
    4.         _PlaySFXClip.HandleEvent(animationEvent);
    5.     }
    6.  
    7.     private Action<AnimationEvent> PlaySFXAtTransform()
    8.     {
    9.         return delegate (AnimationEvent animationEvent)
    10.         {
    11.             MasterAudio.PlaySound3DFollowTransform(animationEvent.stringParameter, this.transform);
    12.         };
    13.     }
     
    Last edited: Mar 26, 2022
  20. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    Using AnimationEvent at the method's parameter will work, but note that it will allocate some garbage every time the even is triggered.

    Another option would be to use Animancer Events and change them to use Ult Events which can call methods with any number of parameters.
     
    techniquea2z likes this.
  21. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,549
    about a month into using Animancer and it is incredible, really speeding up my iteration time. Thank you.

    My question is I set boolean isAttacking = true so that I can only play one attack animation at a time. I have set an OnEnd event to reset it to isAttacking = false after the animation plays.

    But sometimes I want to interrupt the animation with another one before it finishes. In that case the OnEnd never fires because the animation doesnt reach the end point, and my isAttacking never resets because the function to reset it never fires either.

    Is there a way maybe if another animation interrupts it, I could broadcast out some other event, like maybe some kind of state.onInterrupt or something as a failsafe to tell my current animation to play my OnAnimationEnd function?
     
  22. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    You could do that with an Exit Event, but the Interrupt Management example explains a couple of better ways you could do it if you use a proper state machine system.
     
    protopop likes this.
  23. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,549
    Thanks so much for the links and the suggestion - and for Animancer:)
     
  24. Airship

    Airship

    Joined:
    Sep 10, 2011
    Posts:
    260
    I have character where I have run animations on layer 0 and then attack animations on layer 1. The layer 1 has an upper body animation mask. The attack animations I play with something like

    Code (CSharp):
    1. _animancerComponent.Layers[UpperLayer].Play(attackClipTransition, 0.15f, FadeMode.FromStart);
    The problem is once the attack animation is done, the end position of the animation still affects characters upper body and the state on that layer seems to just keep playing forever. I guess I can lower the weight of layer one if no animation is playing, but wondering if there is a cleaner / default way to have the influence of the layer stop once the animation should be done playing.

    Edit
    Nvm, just realized this is covered in the layer example by setting an OnEnd event and stopping the transition.

    Code (CSharp):
    1.  
    2. var state = _animancerComponent.Layers[UpperLayer].Play(clipTransition, 0.15f, FadeMode.FromStart);
    3. state.Events.OnEnd = () => state.Stop();
    4.  
    https://kybernetik.com.au/animancer/docs/examples/layers/
     

    Attached Files:

    Last edited: Mar 31, 2022
    kana1939 likes this.
  25. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    Stopping the state like that wouldn't give a smooth transition. I'd recommend fading out the layer like the example does.
     
    kana1939 likes this.
  26. Rossakis

    Rossakis

    Joined:
    Sep 5, 2018
    Posts:
    6
    Hello !
    New user of Animancer Pro here, so I’m still learning how to properly use it.
    I have perhaps a noob question : I have 2D sprite animation called “Idle”, that goes into “Walk” animation as long as the player presses A or D (I’m using the AnimancerComponent.Play(Walk) method btw).
    However, whenever the player goes from “Walk” to “Idle” state, the Animancer system waits for the “Walk” animation to finish its last frame and only then goes into the “Idle” state.
    Isn’t the AnimancerComponent.Play(Idle) method supposed to stop the previous animation immediately and instead play the “Idle” animation ?
    Should I use AnimancerComponent.Stop() method before it, if I want the animation to immediately snap into the other one?
     
  27. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    Play will take effect immediately and calling Stop yourself is rarely necessary.

    The problem is likely something else. What does your code look like? Are you perhaps using an End Event to call Play?
     
  28. Rossakis

    Rossakis

    Joined:
    Sep 5, 2018
    Posts:
    6
    Actually yes, I used "Events.OnEnd" like in one of your examples in order to switch from "Walk" to "Idle". So, if I want an immediate animation switch, can I just have an
    Code (CSharp):
    1. if (playerDirection != 0 && grounded)//when player presses D or A
    2.             {
    3.                 _Animancer.Play(Walking);              
    4.             }
    5. else{    
    6. _Animancer.Play(Idle);
    7. }
    8.  
    or something among those lines? Or is this method not preferable and there is a better way to get the same results?
     
  29. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    Yes, that's a perfectly fine way of doing it. One of the new examples I'm working on for the next version of Animancer does it exactly like that.
     
  30. Rossakis

    Rossakis

    Joined:
    Sep 5, 2018
    Posts:
    6
    Alright. Thank you very much! (loving this asset quite much already).
     
  31. ncorns

    ncorns

    Joined:
    Jan 15, 2017
    Posts:
    10
    We had the exact same dilemma. In our case, we had a central method for PlayAnimation() which took some parameters for the clip to play but most importantly, it had access to the previous Animation State that played so we could iterate through the events one by one BEFORE the next animation plays and if it was a "finish" based event that we wanted to ALWAYS fire, we called the Callback() method for it. Works great.

    Short example:

    // Run all outstanding events
    foreach (AnimancerEvent e in currentState.Events)
    e.callback();

    currentState = AnimancerHybrid.Play(animationObject.Clip, animationObject.FadeIn, FadeMode.NormalizedFromStart);

    The only thing we have in addition to the above is the TYPE of event. We added our own custom property to the AnimancerEvent object to hold this information (effectively like an enum) so we know what kind of event it is and whether to call the CallBack() or not for it (so all events work as default but FINISH based events always fire). Hopefully you get the idea.
     
  32. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    You can access the previous state (i.e. the most recently played) using animancer.States.Current or animancer.Layers[x].CurrentState.

    And Event Names might let you achieve something similar to your event types.
     
  33. Jihaysse

    Jihaysse

    Joined:
    Mar 29, 2020
    Posts:
    53
    Hello everyone,

    Thanks Kybernetik for this amazing asset.

    I was wondering if there's a way to use a Float1ControllerTransition (Asset or not) with an Animator Override Controller? I've got cast errors when doing so as it's trying to cast it as an Animator Controller.

    I'm trying to have a blending walk/run animation for each of my monsters and I'd like to not have a hundred Animator Controller if it's doable. Otherwise I'll stick with the Animator Controller.

    Thanks for your help!

    Kind regards
     
  34. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
  35. Jihaysse

    Jihaysse

    Joined:
    Mar 29, 2020
    Posts:
    53
    Thanks for the fast answer!
    I can't find a GetParameterDetails method in ControllerState.cs (using CTRL+F). Could it possibly be the method ValidateHasParameter?
     
  36. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    Yes it is, I forgot how much I had changed that system. I've edited the fix.
     
    Jihaysse likes this.
  37. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    303
    Hello
    I'm having an issue with AnimancerLayer.IsAnyStatePlaying
    It returns false when no clip had played before, but after a clip has played in that layer it will always return true, even if a clip has ended playing on it.

    Is this a bug? How can I check if a any clip is currently and still playing on a given layer?

    Thanks
     
  38. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    When an animation passes its end it is still considered to be playing and its time continues advancing even though it only shows a single pose.

    If you want to make sure it hasn't ended you could check
    if (animancer.Layers[x].CurrentState.NormalizedTime < 1)
     
    Hazneliel likes this.
  39. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    303
    Thanks, that works!
    However it is also necessary to check animancer.Layers[layer].CurrentState for Null or else it will throw an Exception the first time you play a clip.
     
  40. One_Learning_Man

    One_Learning_Man

    Joined:
    Sep 30, 2021
    Posts:
    80
    Oh this sounds interesting. Are we talking about a patch or Animancer V2?
     
  41. Willbkool_FPCS

    Willbkool_FPCS

    Joined:
    Jun 13, 2018
    Posts:
    169
    Just wanted to mention that Animancer Pro is half off the regular price. I've tried the free version and really like it, so I just picked up the Pro version.
     
    Kybernetik likes this.
  42. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    @One_Learning_Man Here's the work in progress Change Log for Animancer v7.3. It doesn't have much in the way of new features, but a lot of work has been done on the examples and there's a decent set of improvements, changes, and fixes. The newly reworked Basics examples are here if anyone wants to check them out (I'll overwrite the old ones on release) and any feedback would be appreciated. The one I was referring to before is Simple Movement.

    The new version is already stable and basically feature complete. Most of the remaining work that needs to be done is on the examples. So if anyone wants to get early access to it just let me know (for Animancer Pro, just email me your Invoice Number so I can verify your purchase).
     
    One_Learning_Man likes this.
  43. Todiloo

    Todiloo

    Joined:
    Jan 22, 2016
    Posts:
    53
    Anyone got tips for making mixer transitions that can randomize between multiple idle animations:

    upload_2022-4-14_22-2-44.png

    I got like 3 Idle animations that it would be cool to switch between.
     
    Willbkool_FPCS likes this.
  44. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    I'd leave the locomotion mixer like that and handle random idles completely separately. The Idle state in the 3D Game Kit example just has an array of ClipTransitions for each of the random animations and its Locomotion State has an idle/walk/run mixer like yours.

    If you actually do want your random idles to be used while blending between them and the walk animation, you could set up a Nested Mixer.
     
  45. Todiloo

    Todiloo

    Joined:
    Jan 22, 2016
    Posts:
    53
    Thank you for the quick reply. What do you mean by handle random idles completely separately? Should I instead replace the Idle animation in the mixer manually somehow?

    For this use-case maybe it is overkill since I probably dont even need to do a mixedstate between idle->walk->run but more likely just walk->run .

    However it would be nice to know how to do it.
    I tried a Nested Mixer where the idle state instead was a "ManualMixerState" , didn't really know the correct way to control that one, I guess I just set the weight to the random idle animation I currently want to play?

    And finally for the 3d toolkit example I haven't been able to make it run. I created a new 2019 project, imported 3d toolkit then animancer.
    When I play it I get


    Code (CSharp):
    1. TypeLoadException: Could not load list of method overrides due to  assembly:C:\Program Files\Unity\Hub\Editor\2020.3.9f1\Editor\Data\Managed\UnityEngine\UnityEditor.CoreModule.dll type:SceneView member:void {0}() signature:OnSceneGUI
    2. Animancer.Editor.TransitionDrawer.OnGUI (UnityEngine.Rect area, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at <af4162bfcfaf49689164d194a32759ed>:0)
    3. Animancer.ManualMixerTransition+Drawer.OnGUI (UnityEngine.Rect area, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at Assets/Plugins/Animancer/Utilities/Transitions/ManualMixerTransition.cs:180)
    4. UnityEditor.PropertyDrawer.OnGUISafe (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at <9540aba417024bb296674f70fa788b73>:0)
    5. UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at <9540aba417024bb296674f70fa788b73>:0)
    6. UnityEditor.GenericInspector.OnOptimizedInspectorGUI (UnityEngine.Rect contentRect) (at <9540aba417024bb296674f70fa788b73>:0)
    7. UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <ab574a2f598240d68c66d280c533b9d3>:0)
    8. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    9.  
    10.  
    And as soon as I run it I get these:
    upload_2022-4-15_10-54-3.png
    The nullreferenceexception seem to be pointing at the Animancer > Player >State object.

    My end goal is this, if that helps understanding my "problem". It's a RTS controller, so no waypoint navigation controlled and now keyboard/gamepad 3d-person controller

    aa.png
     
  46. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    While moving, you use that mixer as is. If you want to go slow, it just blends between walk and your main idle animation.

    And while completely stationary, you just play the main idle animation most of the time and periodically pick a different one from an array. Just play them as individual animations, they have nothing to do with the mixer.
    Yes, controlling the weight of each animation is what manual mixers are for, but like I mentioned earlier, if you aren't actually blending between the animations then you don't need a mixer at all. Just make an array of animations and play whichever one you want whenever you want to change.

    The path in the first error line seems to indicate that you're using Unity 2020.3 rather than 2019, though both versions should work fine.

    With Animancer Lite, make sure you re-import Animancer via the Package Manager (rather than just copying the files from another project) any time you change Unity versions because there are slight differences in the pre-compiled DLLs due to changes in Unity's APIs. That's the most likely cause of an error like that.

    The other errors don't matter. Nothing will work properly after that first one.
     
    Todiloo likes this.
  47. One_Learning_Man

    One_Learning_Man

    Joined:
    Sep 30, 2021
    Posts:
    80
    I would organize my states under an empty GameObject called states:

    upload_2022-4-17_12-18-29.png

    Character.cs has a reference to all of these states but I have to open two inspector windows and manually drop the right states since by default, Unity just takes the first state from the game object.

    Is there an easier method that you know of that doesn't involve having two inspectors open? Where I can click the state field in Character.cs and simply choose the right one? It's not a big deal but I bounce and start new projects a lot and while it doesn't take long to set up two inspects I thought I'd stop by and ask anyway.

    Does Inspector Gadget have anything regarding this?
     
    Last edited: Apr 18, 2022
  48. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
  49. One_Learning_Man

    One_Learning_Man

    Joined:
    Sep 30, 2021
    Posts:
    80
  50. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    125
    Hi, I'm pretty new to Animancer and am currently working on converting my project over, one piece at a time, before using it fully. We currently have an animator controller for locomotion (and some other stuff) and have override controllers for swapping out animations.

    I am using a
    HybridAnimancerComponent
    and I have extracted the attacks and some other stuff and am playing them directly through
    _Animancer.Play(clip)
    All good so far, however, we are still relying on the Animator Controller and it's overrides for locomotion (and some other stuff).

    I am having an issue getting our animator controllers to work properly. Our default controllers work great, but once we switch controllers it seems that parameters are not getting set on the override controller.

    In our Locomotion Controller I have
    _Animancer.SetFloat("Speed", x)
    and locomotion works great.

    Another component (Motion Controller) changes the active animator controller to the proper override when necessary. In Motion Controller, I have a serialized field for
    ControllerTransition _Default
    and another
    ControllerTransition _Override
    , but when I do
    _Animancer.Play(_Override)
    it transitions and plays the default controller state from the override controller correctly, but now in the Locomotion Controller
    _Animancer.SetFloat("Speed", x)
    seemingly does nothing. From what I can tell, everything is just stuck in the default state of the override controller.

    I also tried changing the Controller property
    _Animancer.Controller = _Override
    but now when the Locomotion Controller calls
    _Animancer.SetFloat("Speed", x)
    I get this:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Animancer.HybridAnimancerComponent.SetFloat (System.Int32 id, System.Single value) (at Assets/Plugins/Animancer/HybridAnimancerComponent.cs:312)
    Any assistance would be greatly appreciated.