Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by Zethros · Sep 14, 2014 at 05:39 PM · 2d animationcrossfadeorganization

[Unity2D] How best to manage having many different animations for a single GameObject

About Me

  • New to Unity.

  • Experienced in creating a fighting game.

  • C# developer by trade.

The Basis:

I am making a fighting game with rather complex characters. Think Super Smash Bros (ignore the pony...) with 2D sprites. Think of all the different animations a single character would need. (Walk, Run, Jump, 10+ Attacks, 5+ Specials, Hurt, Smashed, Grabbed etc etc). I want to try to make this as simple, clean and organized as possible.

My Thought

The following picture is the closest solution I've gotten to, but it's flawed. Using a Blend Tree, I would hold all the animations of a kind (such as "Attacks") in a make-shift array and using the parameter "AttackID" I could fetch the animation I would like.

But again, it is flawed. The Exit Time, for example, must be the same for every animation, which is far from ideal if I am to have any variety in Attacks for the game.

Animator Control View alt text

A Better Alternative Anyone?

Does anyone have any experience with handling a ton of different animations for a single character? Any ideas on what I can try?

Thank you in advance,

-Zethros

Edit (3 Hours later):

Realized that there is a Animator.Play() function. I can manually (programmatically) handle these many animations rather than rely on the automated system. More details as things progress.

Edit #2

Using animator.CrossFade("AnimationStateName",0f,-1,0f);. Full answer below.

capture.png (50.6 kB)
capture2.png (27.0 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 Zethros · Sep 15, 2014 at 12:23 PM

(Sorry for answering my own question but...)

animator.CrossFade("AnimationStateName",0f,-1,0f);

Using this line (including the number arguments), I am able to switch animation states programmatically, interrupting the current animation state in the process. Animations go to Idle via Exit Time 1.00 and no longer require an "Attack" trigger or "AttackID" int parameter.

The Animator State Machine will be a bit cluttered (especially without the ability to zoom out) but that appears to be the price of complexity.

Organized Complex Animation Layout

I do hope this helps someone,

-Zethros


capture.png (58.8 kB)
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

2 People are following this question.

avatar image avatar image

Related Questions

Problem with animations, How to blend them?? 0 Answers

Play one animation after another... need help with Queued 1 Answer

Animation/CrossFade difficulties, Animation won't CrossFade 0 Answers

Can't crossfade quickly between two audio tracks? 1 Answer

Organize the hierarchy a bit more? 1 Answer


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