Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Transition from all states inside sub-state machine

Discussion in 'Animation' started by GarlicDipping, Nov 5, 2016.

  1. GarlicDipping

    GarlicDipping

    Joined:
    Sep 7, 2013
    Posts:
    31
    Hi, I've been refactoring my complex animator controller recently, and faced some problems using sub-state machine.

    Here's my example screenshot :



    I just need to come and go between "Fall" and "GroundMotions" substatemachines, with 'grounded' bool condition. Whatever state is playing inside sub state machine, when condition is right I want to cancel it and transit between each other.

    But, to do this, it seems like I have to add transitions for ALL states inside each substatemachine...

    I know there's "Any State" feature, but there's no substatemachine specific "Any State" yet.

    So, are there no options other than just use Animator.Play in onStateUpdate()?

    Thanks for your answer in advance!
     
    marcospgp likes this.
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,391
    That would be so nice. Sadly, no can do without scripting.
     
  3. GarlicDipping

    GarlicDipping

    Joined:
    Sep 7, 2013
    Posts:
    31
    Thanks for the answer. Wow, well, that's...so...sad... :(
     
  4. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,674
    Have you try with Entry and Exit state?

    At least with entry and exit node when you add a new state you don't need to add a transition for all possible permutation
     
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,391
    They're already using the exit/entry nodes (see the screenshot, the arrow's gray, which indicates a machine transition).
     
  6. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,674
    ah true, I didn't spot it the first time
     
  7. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,391
    So what do you think about an "any internal state" node, which works like the any-state node, but only as long as you're inside of the substatemachine the node's in?

    Setups like @GarlicDipping's, where you want to exit a machine no matter where you're in it, are pretty common. an Any Internal State node would help a lot. It'd also reduce the number of transitions and make the state machines much more appealing and readable.
     
  8. GarlicDipping

    GarlicDipping

    Joined:
    Sep 7, 2013
    Posts:
    31
    Yup, as @Baste says, 'Any internal state' node will be really helpful. I found there's already feedback here, but seems like it's not on the spotlight yet...
     
    RemDust likes this.
  9. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    377
    OMG @Mecanim-Dev plz implement it guys!

    It's needed, and would improve the mecanim workflow a lot, its usability is very high
     
  10. fup

    fup

    Joined:
    Jan 18, 2016
    Posts:
    76
    yup, this feature would be extremely handy
     
  11. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    377
    I agree, - even though it would mean having to check more outgoing transitions, to see what the user intended to do. Who cares, just do it guys!! it will be amazing
     
  12. homer_3

    homer_3

    Joined:
    Jun 19, 2011
    Posts:
    89
    Would still love to have this. Hopefully it gets added.
     
  13. kyuskoj

    kyuskoj

    Joined:
    Aug 28, 2013
    Posts:
    41
    no more updates? we need this feature so much.
     
  14. azevedco

    azevedco

    Joined:
    Mar 2, 2014
    Posts:
    9
    Heh...Jumping onto this bandwagon too. A node for 'Any internal state' would be beautiful.
     
  15. Tiernan98

    Tiernan98

    Joined:
    Jul 11, 2017
    Posts:
    38
    Just saw this thread when I was googling. Have so many situations like this in my game. Currently, I am calling Play/CrossFade on the animator in the player controller's state machine (not the Mecanim one). It would be very neat to have some default state within a sub-state machine that you can transition to.
     
  16. io-games

    io-games

    Joined:
    Jun 2, 2016
    Posts:
    94
    +1 for "any internal state".
    I need to exit to parent state from all of these.
    upload_2021-1-18_18-28-41.png
     
    marcospgp likes this.
  17. marcospgp

    marcospgp

    Joined:
    Jun 11, 2018
    Posts:
    65
    Is the Unity team aware of this? Would be really useful.

    Right now the only way to do something similar is to add a transition out of the global Any State node, which doesn't always fit with what one wants to do, or adding transitions from each sub state machine node to the Exit node.
     
    Tiernan98 likes this.
  18. carcasanchez

    carcasanchez

    Joined:
    Jul 15, 2018
    Posts:
    146
    I'm in the same situation. It feels ridiculous Unity has been aware of this since 2016, and you have still to do a one-by-one transition when working with sub-state machines.
     
    Tiernan98 likes this.
  19. hyagogow

    hyagogow

    Joined:
    Apr 25, 2014
    Posts:
    18
    I'd really appreciate this feature as well.
     
    bluescrn and marcospgp like this.
unityunity