Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by kyram · Oct 07, 2015 at 05:54 AM · unity 5animatormecanimstate-machinetransitions

Transition to multiple states from Entry Node in Unity 5

I'm trying to create a simple 2d animator where the direction the sprite faces when a scene loads (ie. Right, Left, Up, etc.) depends on the direction the sprite faced in the previous scene.

alt text

I followed the tutorial here and created a sub-state machine with just 2 states, facing right and facing left. I made the "facing right" state the default, and added a transition from Entry Node to the "facing left" state with the condition that direction = 1.

Then, I added a behavior to this sub-state machine with the following line:

 override public void OnStateMachineEnter(Animator animator, int stateMachinePathHash){
         animator.SetInteger ("direction", 1);
     }

However, when I hit play, the animator still goes to the default right state. I've tried a bunch of things but it seems like I cannot get it to do anything beside the default transition from Entry. The fact that I cannot find an answer to this question online makes me feel like I missed something completely obvious, but for the life of me I cannot figure it out.

capture.png (37.3 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by kyram · Oct 07, 2015 at 05:51 PM

This solution doesn't solve the Entry Node only using the default transition, but I was able to solve my particular problem using blend trees. In my case I had a blend tree named "Idle" (the default state) and a blend tree named "Run". In each blend tree I used a float parameter to control which idle and which run animation to play (ie. left or up or right). It works for 2d animation because I'm not using the blending feature. I would never need to set the float parameter to be midway between two thresholds.

But if anyone has any thoughts about the entry node only using default transition, please share!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Checking Transitions in Animator 0 Answers

Mecanim state that keeps last pose? 0 Answers

Issue with mecanim playing an animation using setbool 1 Answer

Mecanim - State Behavior - Select motion clip to play at runtime 0 Answers

Issue with animator not working when key is pressed - Script and Animator communication - 2D - MissingComponentException 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges