Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 TheDividedSegment · Feb 27, 2017 at 11:34 AM · animationbuttonmenuclickslide

Playing different button animation after first animation plays

Sorry if the title doesn't make much sense, ill try to explain. I have animated my button so that on the first press, it will look like this:

alt text

I want to make it so that once you click the down arrow, or on the second press, the menu will close and go back to this state:

alt text

I have both animations setup, but I cannot figure out how to make the button go back to the original state after the menu slides up.

scrollup.png (217.0 kB)
scrolldown.png (93.8 kB)
Comment
Add comment · Show 1
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 _Yash_ · Feb 27, 2017 at 11:34 AM 0
Share

You can have two empty objects representing up position and down position. Use reference to these 2 transforms to get target positions for animations.

1 Reply

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

Answer by KonfuPanda · Feb 28, 2017 at 07:44 AM

You can create one bool parameter in the animator controller. Then you can attach a button component to the menu or some kind of script which can detect a mouse click/touch (whatever you need) so you can change the parameter via script. Then you set up the animator controller so on one value it (true) it goes to the state in the first pictute and on the other value (false) it goes to the state in the second picture. Pseudocode:

     Button myButton;
     AnimationController myAnimController;
     bool myState;
     
     void Awake()
     {
        myButton.onClick.addListener(changeMenuState);
     }

     void changeMenuState
    {
        myState = !myState;
        myAnimController.setBool("BoolParameter", myState);
    }
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 TheDividedSegment · Mar 02, 2017 at 12:56 PM 0
Share

Thank you, the explanation was a perfect step in the right direction! Solved it perfectly.

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

How To Play Animation On UI Button Click Please... Im Going To Freak Out Please Enter And Help Me 2 Answers

How to implement Clicking in Unity-GearVR by pointing Light??? 1 Answer

How can I stop an animator playing 0 Answers

mouse clicked on object animation c# 1 Answer

How to use button multiple times 1 Answer


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