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
2
Question by marconi · Oct 11, 2014 at 04:04 AM · animationanimatortriggertransition

Animator does not reset well when reactivating object

Hello, everyone!

I have a 2D cutout-animated GameObject with 3 animation states: Idle (loop), Interact (non-loop) and Leaving (non-loop). When the user clicks on the object, a trigger is sent to start the Interact animation, and it transitions to the Leaving animation via Exit Time. I also have another trigger, called Idle, which resets the animation to the Idle state.

It all works fine... until I deactivate the GameObject while it is on the Leaving state. By reactivating it, the animator is back on the Idle state, but many parts of the object are on weird positions, and some sprites are wrong. It seems all the changes made by the last animation Leaving which are not "undone" by the Idle animation stay there.

If it was supposed to work like this by design, how come transitioning through the whole cycle while the object is active works fine? Any ways to fix this?

Thank you!

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

3 Replies

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

Answer by Forest3 · Apr 13, 2016 at 11:36 AM

What worked for me was to make an animation with all default values, and then play it before deactivating the object. I think is kind of easy, but let me know if you need more specific details.

Comment
Add comment · 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 pep_dj · Apr 13, 2016 at 11:56 AM 0
Share

Very good solution! Anyway, wold be great to be able to use the editor values ins$$anonymous$$d of re-define them in an animation.

avatar image marconi · Apr 13, 2016 at 05:27 PM 0
Share

Forest3, yes, I solved it in a similar way. Using my question as an example, I had to add other curves to the Idle state to make sure that, when entering Idle, the object would behave as expected. It is like... "locking" some values so that, in case they are changed by other states, they return to the expected value.

  • Upside: it avoids creating an extra state to reset the values, I reset them on the default state(Idle)

  • Downside: I have to do a sort of "diff" between Idle and the other states to know which curves I have to add, which is very error-prone. And Idle suddenly has curves that do nothing just for the sake of fixing this.

Pick your poison, I guess :P

avatar image Highwalker · Apr 13, 2016 at 08:39 PM 1
Share

Alternatively you can deactivate the animation controller and re activate it right after. That works for me.

avatar image
2

Answer by pep_dj · Apr 12, 2016 at 09:53 AM

Hi @marconi. I'm having exactly the same issue. Please, can you tell us if you finally solved it?

Comment
Add comment · Show 1 · 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 marconi · Apr 13, 2016 at 05:28 PM 0
Share

pep, I answered on Forest's answer! Similar approach.

avatar image
0

Answer by yukamui · May 21, 2018 at 04:38 PM

Maybe this tip is too obvious, but it wasn't for me at the time so I will share it.

Since you need that the DEFAULT animation has the same KEYFRAMES of the animation that was playing when it was disabled, What you can do is COPY the keyframes of that last animation, and PASTE them on the FAR end of the DEFAULT animation there you will clearly see the missing keyframes that you need.

Double click at the START and END of the TIMELINE to add that KEYFRAMES that you are missing, DELETE the KEYFRAMES you PASTED and you are good to go.

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

6 People are following this question.

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

Related Questions

Has Exit Time causes between trigger and transition. How can I stop this? 1 Answer

Zero-Out Animation Transition 1 Answer

Combining two animations to be one 0 Answers

Smooth transition of position between animations 0 Answers

On/Off Animator using script 2 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