Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Animator issues (With code I think?)

Discussion in '2D' started by maddaddam12, Feb 22, 2019.

  1. maddaddam12

    maddaddam12

    Joined:
    Feb 19, 2019
    Posts:
    7
    I've been trying to get the animator to work for my idle to walk animations but i cant get it to move from "idle" to "run" It'll play the idle animation and if I force the "isRunning" condition on it does the proper animation but it wont trigger "isRunning" when I use the arrow keys.

    Ill post some hopefully helpful images here





    Edit: another image
     
    Last edited: Feb 22, 2019
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    Hi @maddaddam12

    ...actually the first image doesn't help that much.

    Check your transition condition (which doesn't show in your animator screen capture).

    You transition condition (click arrow line from state to state to see it) should have a condition of isRunning being true.

    Otherwise even if code looks right, it might not work because of this.

    So, Idle ===> PRoll (your run state? I guess...) transition should have this condition.

    See this page (first image shows transition conditions):
    https://docs.unity3d.com/Manual/class-Transition.html
     
  3. maddaddam12

    maddaddam12

    Joined:
    Feb 19, 2019
    Posts:
    7
    sorry about that, I do have isRunning true for idleTest -> PRoll I believe it's right but I suppose I might be missing something, I swear I've done this before and had no issues :(
     
  4. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @maddaddam12

    I'm bit tired and I don't see any obvious problems. Some ideas, unless someone else sees something obvious:

    Try to remove else from your code, see if you first get one way transition from idle to run.

    Also check that both your states have animation clip assigned.

    Also check that animation clips work / you see the animation in preview.