Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Animator keep switching "apply root Motion" to "handle by Script"

Discussion in 'Animation' started by Krillan87, Jan 27, 2017.

  1. Krillan87

    Krillan87

    Joined:
    Mar 25, 2015
    Posts:
    11
    Hi,

    This is my first ever forum post, I'm really hesitant to make posts but I've been googling on this issue for quite some time now and I have no clue on what to do...
    To be honest I do not know if this is a Playmaker issue or Unity issue (or me issue) but maybe someone have encountered this problem as well and could help me out.

    So, what happens is that today when I started Unity to continue develop my game the 3rd person character could not move. I was very surprised because everything worked fine yesterday, and I have literally haven't changed anything from yesterday.
    After a lot of investigation I found out that for some reason the "Apply root motion" switches to "handle by scrip" when I playtest the game.

    The only scripts I have a are playmaker FSMs (except for one small custom scrip). I've disabled every playmaker FSM on the character but it still switches to "Handle by script".

    Before I go into detail about the setup. the game etc. I just gonna start to see if anyone ever encountered anything like this before and could just point me in the right directed. (ps. this have happened one time before and my solution then was to delete the whole character and start over from scratch...)

    Thanks!
     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Some questions to ask before we can help.
    Did you create this character yourself, or get it from somewhere? A lot of characters off the asset store and from other places have code bits that they need to link the input methods to the animations. Check for these.

    Did you create the animations yourself or get them from somewhere else? Commonly each animation has different settings and require modification in the inspector to work as expected for a different particular character.
    The "handle by script" could be happening when the character transitions into one animation with this setting.

    For testing - so you can solve the problem yourself - suggest importing the character into a clean/new scene. Setup the character with all the animations used in the original project, and get it working properly, testing to make sure root motion is working as desired.

    If you can do this without issue, then the character and animations are not the problem.
    Then the problem obviously lies in your project - and possibly the FSMs you have.

    Process of elimination.
     
  3. Krillan87

    Krillan87

    Joined:
    Mar 25, 2015
    Posts:
    11
    Thank you for your answer. I have not done any character nor animations myself, everything is from the asset store. I have tested everything both in a new scene and in the game and everything word fine up til now. (And yesterday my game was working perfect, so the issue seems to just come from nowhere)

    After hours of testing and elimination there seems to be a bug that makes the specific state within a FSM corrupt. If I delete the last state I been working on, everything works fine again.

    If a copy all the states from that "bad FSM" and paste them in a new fresh FSM, the same problem appears.

    If I manually re-create the FSM, identical to the old FSM. The issue disappears and everything works fine.

    I even took it one step further and tested after each state in the FSM to identify which state within the FSM that caused the issue. When I found the "corrupt" state it included only two actions. One that set a animator int to "99" and one that disabled left mouse button .

    My only conclusion here is that this is some kind of a bug within either Unity or Playmaker. Right now I haven't found anyone that seems to know why this is happening so I just keeps my fingers crossed that I won't run into this issue to many times in the future. Do you have any input? Any wild shot on what could be causing the issue?

    Thanks for the answer :)
     
  4. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Huh! This does sound like a bug.

    Does changing the animator int to a different number - still cause the error?

    Suggest reporting this to hutong on there support forum - http://www.hutonggames.com/
    Or if you can report through the Playmaker manager thingie.
     
  5. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    The handled by scripts message appears whenever you have OnAnimatorMove implemented on your GameObject, or if you have a StateMachineBehaviour that implements OnStateMove.

    I imagine something in PlayMaker had this implemented.
     
    nxtboyIII, GilCat, kaleidos_t and 8 others like this.
  6. Th0re

    Th0re

    Joined:
    Sep 4, 2015
    Posts:
    39
    Found this thread because I had the same issue. I think I found the culprit.

    When you add certain special actions, they'll attach a script component to the game object with the FSM. One of them adds a script component called PlayMakerAnimatorMove (deprecated or legacy?). When you remove that one, the Root Motion can be switched manually again. However, removing the script component will probably break the action that relies on it. You can apparently check the component and see if it is hooked to some event.

    I found that I have not used anything knowingly that might use it (or have tested it long ago, and since removed the action), and in my case doesn't have anything listed there.
     
  7. kaleidos_t

    kaleidos_t

    Joined:
    Jul 23, 2019
    Posts:
    1
    Thank you for your reply. Even an OnAnimatorMove was implemented, the animator will show "handled by script
    "