Forum rules - please read before posting.

Playing custom animation with Sprite Unity Animation Engine

Hi, I am using the Animation Engine: Sprite Unity for a NPC. At some circumstances, the NPC needs to play custom animator state (mostly by the Play() script and sometimes by actionlist). However, the animator keeps switching back to the idle animation by the Animation Engine. I tried changing the Animation Engine to Custom before calling the custom animation but it doesn't work somehow...

Is there an option to stop the default animations and play custom animator state? Or maybe can I change the Standard 2D Animation Idle name by script?

Thanks.

Comments

  • Please always let me know your AC and Unity version numbers.

    There's no need to switch engine. The 2D Demo's Player character, Brain2D, uses Sprites Unity - and plays custom animations when interacting with objects in the Park scene.

    If you're controlling the Animator directly through script, however, you need to set their "charState" enum to Custom - this will prevent calls to play their standard idle/walk etc animations:

    NPC myNPC;
    myNPC.charState = CharState.Custom;
    

    This is best left to Actions, since it'll do this automatically - and set it back to CharState.Idle afterwards if you have Return to idle after? checked.

    "Sprites Unity" works by playing animations directly by name, but if you switch to "Sprites Unity Complex", then it's all based on Animator parameters. Playing custom animations is then just a case of changing parameter values that cause different animations to play via transitions - no need to worry about the charState.

  • Cool it works great! Thanks!

  • Thanks it works, but except one case: When the NPC has to walking along a path while playing a custom animation at the same time, it always play the walking animation. I tried putting the Character > Animate action in front, behind, and parallel to the Character > Move Along Path action. What would be the correct settings?

  • Is this a "Sprites Unity" character?

    Temporarily change their walking animation to the custom one, via the Character: Animate Action's Set standard method.

  • Got this, thanks. By the way, I found in Character: Animate, the walk and run speed scale cannot be changed if the character animation engine is set to *Sprites Unity Complex**.

  • Is it not appearing, or having no effect?

    The way to do this with "Sprites Unity Complex" is to set the Method to Set Standard, then the Parameter to change to Move Speed Float. You'll then be given an option to change the speed.

  • Cool I got it. Thanks.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!