• 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 WTDrew · Mar 14, 2016 at 08:26 AM · animationanimatormecanimlayers

Animation motion on base layer does not play after additional motion on second layer

I apologize for the length of t$$anonymous$$s question, but I could not figure out how to ask it without a substantial amount of context.

I'm working on a project where we're using Unity's animation system to animate some UI elements. In several cases we want to have a base UI animation, and play additional simultaneous UI animations based on various animation triggers. I am attempting to use animation layers to do t$$anonymous$$s, however when I play an animation on a layer other than the base layer, all future base layer animations appear to cease functioning.

I have set up and attached a simple sample project that simulates the use case (I had to strip out the library folder to fit under the upload limit). W$$anonymous$$le the sample scene is running, if the user presses any key (or clicks with the mouse), a simple animation will start. T$$anonymous$$s animation is intended to enable a small red sprite, moves it a short distance in the X & Y direction, then enable a small blue sprite, moves it a short distance in either the X or Y direction, then move both of those sprites back to the origin and disables them.

I have set up the animation state mac$$anonymous$$ne for t$$anonymous$$s animation thusly:

alt text

  1. The BaseState has no motion attached.

  2. RedSpriteIn enables the red sprite and moves it to (5,5). A behavior is attached to RedSpriteIn that randomly generates a number 0 or 1. If a 0 is generated the state mac$$anonymous$$ne transitions to BlueXIn. If a 1 is generated the state mac$$anonymous$$ne transitions to BlueYIn.

  3. BlueYIn enables a blue sprite and moves it to (0,5).

  4. BlueXIn enables a blue sprite and moves it to (5,0).

  5. RedSpriteOut moves the red sprite to (0,0). A behavior is attached to RedSpriteOut that sets the trigger "RedOutStateBegin" in the animation parameters.

  6. SpritesOff waits 60 frames and then disables both the red and blue sprites.

In addition I have two other, nearly identical, layers in the state mac$$anonymous$$ne. These two layers each have an empty animation state as the default state, w$$anonymous$$ch transitions to a state the moves the blue Sprite to (0,0) either from (0,5) or (5,0) as appropriate.

All of t$$anonymous$$s functions as expected, until I get to the SpritesOff state. After the animations in the layers play, the animation in SpritesOff does not play. Disabling the animations in the layers prompts the correct behavior from SpritesOff, but, obviously, that means the animations in the layers do not play properly.

I know t$$anonymous$$s problem can be solved by removing the layers and adding additional states, but I am hoping to avoid that as it forces our artists to create multiple animations that are almost but not quite identical. I want to be able to play two animations simultaneously in the same state mac$$anonymous$$ne. Any advice would be appreciated.

unityanimexample.png (38.1 kB)
animtesting.zip (67.4 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

0 Replies

· Add your reply
  • Sort: 

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to superimpose two animations using the animator? 0 Answers

Correct way to use mecanim and AddMixingTransform? 1 Answer

Mecanim - How to use "Exit Time" for a state that uses negative speed (anim playing backwards)? 2 Answers

C# Help with setting up jump animation 0 Answers

Animation in edit mode with Mecanim 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