• 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 EGGamer · Sep 30, 2017 at 09:30 AM · animatorbooleanbuttonsbooleans

When click on a button, play an animator animations through booleans

Hello people. I'm doing a 3d menu with animations between panels, and I have an animator for the camera to move between different panels. For example: From the main menu to the level selector. I had thought of doing it with an animator component and booleans in the animator, to move from one animation to another, and since the inspector works, but of course, I want to do it through UI buttons, w$$anonymous$$ch, through a script, but I didnt find the method to do that the booleans be changed through the script. If you know how to do it, please help me. Thank you.

(Sorry if my english its not very good U_u)

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
1
Best Answer

Answer by FallingRocketGames · Sep 30, 2017 at 12:17 PM

First you have to call the animator of your game object in t$$anonymous$$s case the panel or the camera with somet$$anonymous$$ng like:

       public Animator animatorMyObject;

Once you set your variable you can either call it or fill it from the code wit$$anonymous$$n start or awake or drag the object to the inspector panel if you make it a public variable.

Once you do that you can access the properties of the animator in your case the boolean with an instruction like:

        animatorMyObject.SetBool("Exact_Name_of_the_boolean_in_animator", false);
        animatorMyObject.SetBool("Exact_Name_of_the_boolean_in_animator", true);
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 EGGamer · Sep 30, 2017 at 01:47 PM 1
Share

I´m going to try it, thanks.

avatar image FallingRocketGames EGGamer · Sep 30, 2017 at 05:28 PM 0
Share

glad to help, don't forget to mark the answer as correct points are appreciated ;)

avatar image
1

Answer by EGGamer · Sep 30, 2017 at 02:03 PM

IT WORKS! Thanks @jointothedarkside ! See how it looks: https://youtu.be/JUmQ8Dk_q_8 Thank you very much!

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
avatar image
0

Answer by unity_G2yrNlWYdpJKuw · Sep 30, 2017 at 12:03 PM

I don't completely understand you, but try watc$$anonymous$$ng t$$anonymous$$s video and I hope it will help you! https://www.youtube.com/watch?v=f5Eg3t3glWs

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.

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

78 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 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 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 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

Jump animation anticipation 2 Answers

How can i reverse all the booleans in a method? 2 Answers

Cant change bool parameter in animator in a script 2 Answers

Stop Animation State in Animator from Speeding Up after Playing it a Second Time? 0 Answers

Making a bool stay true for a second/while animation is playing 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