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
0
Question by graslany · Jun 03, 2013 at 10:09 PM · animatorbugtransitionstatecondition

Animator bug when activating a transition condition using SetBool

Hi everyone

I got a really weird behaviour with one of my scripts that drives an animator component. My game setup is as follows :

  • I got a ship game object with two moving parts : a mobile armor plate, and a laser weapon.

  • The armor must be opened before the laser weapon can be deployed.

  • It is possible to open the armor without deploying the laser weapon.

A script allows to operate this ship system by calling functions called OpenArmor, CloseArmor, RaiseLaser, and LowerLaser. Both operations can be interrupted and reversed before there are complete (e.g., OpenArmor is called, the opening animation starts playing, then when the armor is half open CloseArmor is called, and the animation plays backwards until the armor is closed again).

To achieve this, I have an Animator with two states (MoveArmor and MoveLaser) and two transitions to navigate between them (see image below). The transitions are controlled using a boolean parameter called ArmorMoving : The animator goes from state MoveArmor to MoveLaser when ArmorMoving is false, and vice versa when it is true. The animation playback speed is controlled by the script and is either 1 or -1 (depending on whever the scripts decides to play the animation forward or backwards).

The problem arises when the laser weapon is deployed and I call CloseArmor() : what I expect is that the deploying animation is played backwards in the MoveLaser state, then the state becomes MoveArmor and the armor animations is also played backwards. The script is in charge of setting the animation speed to -1 (backwards playback) and switching the boolean parameter ArmorMoving from 'false' to 'true' when appropriate, so that the animator controller can change state.

What actually happens is different : the weapon animation is played backwards (as expected). When this animation is fully rewinded, the ArmorMoving boolean parameter is set to true by a call to SetBool (also as expected). The Animator component does not switch back to the MoveArmor state however ! What I see when I display it while the game is running is a total nonsense ; as you can see on the screenshot below (which was taken at the moment when the animator should have switched state - I added the red text for clarity) Unity tells me that :

  • My boolean parameter was correctly set to true (see the checkbox at bottom)

  • Both states are simultaneously active (both have an animation progress bar) !?

  • They both have a negative progress, alost the progress bar normally displays data between 0 and 100% (the small blue bar on the left goes beyond the left bar limit) !?

  • As indicated by the vertical blue line which is progressing towards the bottom of the screen, the state is changing to ... a non-existent state !?

After a careful and prudent examination of this original problem, I came up with the following, considered analysis : What the hell :D !? - Did you already met that kind of problem ? Did I do something wrong, or is it a Unity bug ? I attach my script file to this message.link text

alt text

animbug.png (26.5 kB)
ship.cs.txt (4.5 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.

Follow this Question

Answers Answers and Comments

14 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

Related Questions

Animator conditions, no bool state selector. 1 Answer

Not able to use a Vector as a condition in Mecanim? 2 Answers

(Unity/Mixamo) Animation won't play all frames 2 Answers

Bug animation transitions, or am I the bug? 0 Answers

is it possible to read states / transitions from mecanim in runtime ? 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