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 d-pav · Apr 17, 2014 at 02:24 AM · animationmecanimtransitionanimationstateloop animaiton

How to stop an default animation from playing?

Hi! I have a problem, most likely with the Mecanim, or maybe there is an easy code trick. Anyway, I have this animator setup:

alt text

With the scene start, my object is in the default "New State" state, when I cast a raycast to it, I have a function which turns on a trigger that starts playing "Wall_1" animation. Then I have the "Wall_1_Stop" animation which is just a copy of a last frame of "Wall_1", so it doesn't loop after it is played once. But the thing is that after "Wall_1" finishes playing, it goes to "Wall_1_Stop" and then to the "New State" again, even though I have only one way connections between all of the states. I tried turning off looping in the animation settings, but it didn't change anything. So, how do I prevent it from going back to the default state?

Here is my simple code that is attached to that object:

 void ShrinkFunction (bool shrink)
     {
         if (shrink = true) {
 
             anim.SetTrigger(wallshrink);
 
         }
     }

By the way, what I'm trying to do is when I click on the object, an animation plays only once, which shrinks it down to 1,1,1 cube so it stays this way.

Please help me out here. Thanks you very much in advance!

untitled.png (12.3 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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Adamcbrz · Apr 17, 2014 at 05:34 AM

Remove the connection between Any State and New State. Also as a suggestion, you could change your Wall_1 animation to not loop and then you wouldn't need the stop step.

Comment
Add comment · Show 2 · 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 d-pav · Apr 17, 2014 at 05:58 PM 0
Share

Wonderful! I scratched my head around this problem for days! Everything works now, thanks a lot!

avatar image magister_yoda_ · Aug 16, 2018 at 01:18 PM 0
Share

Hi @Adamcbrz Can you check out this question? Start animation problem

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

22 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

Related Questions

Mecanim loop pose 1 Answer

Animation state not transitioning at 100% 1 Answer

mecanim trasitions auto reset 0 Answers

Mechanim Trigger Issue 1 Answer

Why does this animator appear to occupy two states, but report only one? 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