• 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
Question by Azound · Oct 08, 2011 at 06:11 AM · animationblending

Getting weird behaviour when blending animations of behaviour fields

I'm trying to animate fields in a few components that are children of my main object.

i.e. I have Hero, and under Hero there is a Sword which has a behaviour attached to it that changes texture based on a float field (textureIndex) it contains. Additionally, the player has a Shield set up in a similar way. Using the animation editor, I can create an animation clip that animates textureIndex, and is authored from the perspective of the hero (i.e. it animates the relative path ./Sword.Getcomponent.textureIndex. I author the clip for the Hero because I am using Animation Events to call functions on the hero when the animation finishes. I can then play the animation clip on the hero and see the textureIndex change (as well as seeing the texture change), in addition to receiving the animation events - wonderful!

The problem I am having is that If I try to play a similar animation clip which animates the shield's textureIndex, it will stop playing the clip that animates the sword.

Simple enough, I just need to call animation.Blend("ShieldAnim") rather than animation.Play("ShieldAnim"). This works fine the first time I call blend on a clip, but subsequent calls start behaving oddly. Sometimes it will play the animation twice in rapid succession, and I often times no longer receive the animation event.

Has anybody else run into this? Any advice? Right now I'm looking into writing my own animation system to bipass Unity's AnimationClip system, but I'd rather not go through that.

Thanks!

Comment
fendorio

People who like this

1 Show 0
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
Best Answer

Answer by roamcel · Oct 08, 2011 at 07:03 AM

If I understood your problem correctly, you just have an animation layer problem, as in: animations need to exist in different layers if you need to blend them together, otherwise the last played one will override all the others.

Comment
Azound

People who like this

1 Show 3 · 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
avatar image Azound · Oct 08, 2011 at 08:16 PM 0
Share

My understanding is that if there are two blended animations in the same layer, and they have the same blend weight, they will each contribute 50%. This is also not ideal, since the two animations do not intersect - they animate totally different things. I want to play both animations with 100% weight each.

avatar image Azound · Oct 11, 2011 at 04:59 AM 0
Share

I misunderstood your comment. In order to run two non-intersecting animations at the same time, you don't need any special blending mode - neither Blend, nor Additive. Both give the incorrect result. All you need, as roamcel pointed out, is to put the two animations in separate layers and play them both. Thanks roamcel!

avatar image roamcel · Oct 11, 2011 at 06:52 AM 0
Share

Glad you sorted it out :)

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Animation clips no longer appearing for selection 1 Answer

Deformation Maps Possible? 0 Answers

Animation Blending Problem 1 Answer

Blending animations with mixing transform 1 Answer

Can I make animations snap to a frame? 0 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