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
0
Question by Nephtis · Feb 22, 2018 at 12:49 PM · animation2dspriteanimatoranimator controller

Multiple Animation Controllers

Currently in my 2D sprite-based melee combat game, all of the player's animations are stored in one Animator Controller. This "works" but I'm finding that the number of states and transitions is growing very large, mainly because I have several different weapon types (sword, spears etc.) each with their own movesets.


For example, any given weapon will have:

Attack 1 2 and 3 (basic 3-hit combo)

Heavy Attack 1 2 and 3

Guard

Parry

Idle (as in a little idle animation specific to that weapon, like playing with a dagger by tossing it between your hands)


This is 9 animations for each weapon type. Currently I have 4 weapon types, but I'm planning to add more. This is why my animator controller is getting large and unwieldy.


So I was thinking: For each weapon type, could I give it its own Animator Controller, and then just play the corresponding animation for that animator controller from within the player controller code instead of from the default player Animator Controller? So when you equip a weapon, it could set some reference in the player controller (e.g. "weaponAnimController"), and then when the player presses the attack button, it just plays whatever the current "attack" animation is from the current weapon Animator Controller. (I have a system already that basically does this but it's quite convoluted). This would also enable me to more easily add special weapons, e.g. with unconventional movesets.


I guess I'm asking this just to sanity check it; I don't know much about animating, but I feel like this would be a cleaner and more modular way of handling multiple weapon animations rather than having them all in the same controller with loads of states and transitions all over the place. So:


- Would this work, i.e. can a gameobject be animated by multiple different controllers at the same time, or will this cause issues? Because e.g. the regular player animator controller might be in the "idle" state, but then it's possible to also be in an "attacking" state in the weapon animator controller.
- If it's not going to work for whatever reason, is there a different way of doing this, maybe within the same controller, e.g. using layers, which I'm not familiar with (yet)?
- Would having separate animation controllers for each weapon type impact performance/memory (noticeably) at all? It's not a huge concern for me but it is something I'm aware of.

Comment
Add comment · Show 3
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
avatar image Kossuranta · Feb 22, 2018 at 02:14 PM 0
Share

I don't actully know, but I would think you could do just what you descriped by adding animation layers.

avatar image RobAnthem · Feb 22, 2018 at 04:27 PM 0
Share

I know it is mostly important for 3D, but don't be afraid to use animation layers. You can easily make a layer just for combat, and have all attack types easily organized.

avatar image alexanderledev · Nov 15, 2020 at 10:39 PM 0
Share

Did you ever resolve this issue? I have a similar problem

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by cypriano450 · Jan 06, 2020 at 07:32 AM

@Nephtis I think this can help you solve this problem...

https://docs.unity3d.com/Manual/AnimatorOverrideController.html

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

206 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

2D Animation does not start 1 Answer

Setting animator parameter on a single instance of a prefab sets the parameter for all instances 3 Answers

Object not moving after changing animator parameter 1 Answer

2D Character getting a weapon. Changing it's sprites/animations 0 Answers

Animator warning in editor, animation is preventing script from working 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