Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
This question was closed Jan 28, 2017 at 03:14 PM by Vardas96 for the following reason:

Just needed to check "has exit time" in transitions where the boolean is changed.

avatar image
0
Question by Vardas96 · Jan 24, 2017 at 05:20 AM · animationuipanel

UI buttons->panels animation management

Hello guys! I've been working on a demo of my project for a while, and got some troubles with main menu.

For example, I have buttons like "button1", "button2", "button3" etc (all of them have super cool looking sprites and animations and sounds and damn they're cool but that's not the point). These buttons make "panel1", "panel2" and "panel3" appear, wich is an animation of them moving from the right to the close center of the screen.

I want these buttons to open their own panel while closing another ones. If I hit "button2" when "panel1" is open, "panel1" should go back to the right of the screen outside the camera, and "panel2" should go to the center of the screen, and all panels play their animations simultaneously. Also if I press same button two times in a row, it should open and close the panel it controls.

I'm kinda beginner in Unity, so I made it this way:

  • created 3 states for each pannel. "Off" - entry state when the scene starts (has loop), "Open" - moving to the center, and "Close" - moving outside the camera where it has been before.

  • Also added two transitions between "Open" and "Close", and they set the animation bool "Isopen" to true and false

  • created script for each button with public references to the panels, gameobjects and animators. I named them "Play button", "Exit button" etc, but I apply them to the panels, who have animators needed to trigger. Here is is... I believe it will make you laugh, but hey I tried my best with my current low skills:

    using System.Collections; using System.Collections.Generic; using UnityEngine;

    public class ExitButton : MonoBehaviour {

       // 1. Reference to the play panel;
         public PlayButton playbut;
         public Animator playbuta;
     
         public bool open;
         Animator thisanim;
       
         void Awake ()
         {
             open = false;
             thisanim = GetComponent<Animator>();               
         }
         public void ButPanAnimTrigger()
         {
             open = !open;
             thisanim.SetBool("Isopen", open);
             
             //Checking if other panels are open
     
             //1. Exit panel check
             if ((playbut.open) == true)
             {
                 playbut.open = false;
                 playbuta.SetBool("Isopen", false);
             }
         }
     }
    
    

Here's a picture of animator's structure: alt text

While this, to my surprise, works, the problem is that sometimes (more often than expected) there is a delay when you press buttons fast enough, it can vary up to 0,8 or 1 second, wich can be annoying and I want to get rid of it. Any advice?

123.jpg (117.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

  • Sort: 
avatar image
1
Best Answer

Answer by Vardas96 · Jan 29, 2017 at 02:21 AM

Allright, I fixed the issue, and the answer is quite simple. I just needed to uncheck "has exit time" in transitions that change the boolean, and now my panels are responding to buttons really fast.

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

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

UI Animation Not Playing 1 Answer

Animating a Panel,Animating a panel 1 Answer

Animation not playing on game object activated by script 3 Answers

Unity UI Panel Animation distorts buttons 1 Answer

door open close using unity 4.6.1 new UI system 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