Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 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 JymWythawhy · Jan 19, 2015 at 08:23 PM · guiwindowsunity 4.6

Change in functionality in windows build

Note: I fixed the problem below. It turns out that I had the anchors set up incorrectly, and the wrong animation was set as the default, resulting in the problems I was seeing in the build (which was running at a different resolution than the default set in the editor).

Original:

I'm learning to use the new UI by adding animated buttons for the main menu and the pause menu of a simple game. On loading the main menu, the buttons slide in from the top or the bottom, and on clicking play, the buttons slide out before the new scene loads. In game, if I press escape, I activate a UI image that darkens the screen, and the pause buttons slide in from the top and the bottom, and slide out when I resume the screen. The tutorial I used to learn the basics of the animated main menu is found here: http://www.raywenderlich.com/79031/unity-new-gui-tutorial-part-2

In the Unity editor, everything is working great. When I build the game, however, things don't work correctly. Instead of sliding off the screen at a constant size, the buttons swell as they approach the edge, as if they were lifting off and coming towards the viewer. In game, when I click escape, the pause menu only shows up half the time- sometimes the UI image darkens the screen for half a second before deactivating again, other times the buttons slide in before sliding directly out again and unpausing. These buttons are also doing swelling thing as well.

Any idea why the code would work in the editor, but not in the built exe? I have the regular and the x64 build options, and both act the same.

My code, if it is useful for diagnosis:

 using UnityEngine;
 using System.Collections;
 using UnityEngine.UI;
 
 public class UIManagerScriptGame : MonoBehaviour {
     static public UIManagerScriptGame        S;
     public bool                            paused = false;
     public GameObject                    menuButton;
     public GameObject                    resumeButton;
     public GameObject                    pauseScreen;
     public float                        delayTime = 0.5f;
 
     private Animator                    menuAnimator;
     private Animator                    resumeAnimator;
 
 
     void Awake() {
         S = this;
         menuAnimator = menuButton.GetComponent<Animator> ();
         menuAnimator.enabled = false;
         resumeAnimator = resumeButton.GetComponent<Animator> ();
         resumeAnimator.enabled = false;
         ActivateMenu ();
     }
 
     public void MainMenu() {
         menuAnimator.SetBool ("isHidden", true);
         resumeAnimator.SetBool ("isHidden", true);
         Invoke ("MenuNow", delayTime);
     }
 
     public void Resume() {
         menuAnimator.SetBool ("isHidden", true);
         resumeAnimator.SetBool ("isHidden", true);
         paused = false;
         Invoke ("ActivateMenu", delayTime);
     }
 
     void ActivateMenu () {
         Button menu = menuButton.GetComponent<Button> ();
         menu.interactable = this.paused;
         Button resume = resumeButton.GetComponent<Button> ();
         resume.interactable = this.paused;
         pauseScreen.SetActive (this.paused);
     }
 
     void MenuNow() {
         Application.LoadLevel ("MainMenu");
     }
 
     void FixedUpdate (){
         if (Input.GetKeyDown (KeyCode.Escape) && !paused) {
 
             if(!menuAnimator.enabled)
             {
                 menuAnimator.enabled = true;
                 resumeAnimator.enabled = true;
             }
             paused = true;
             ActivateMenu();
             menuAnimator.SetBool ("isHidden", false);
             resumeAnimator.SetBool ("isHidden", false);
         } else if (Input.GetKeyDown (KeyCode.Escape) && paused) {
             paused = false;
             menuAnimator.SetBool ("isHidden", true);
             resumeAnimator.SetBool ("isHidden", true);
             Invoke ("ActivateMenu", delayTime);
         }
     }
 
 }
 
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

2 People are following this question.

avatar image avatar image

Related Questions

How to trigger a button click from script 3 Answers

GUI.FocusControl not working in android? 0 Answers

Unity 4.6 ui scroll rect won't show up in fullscreen 1 Answer

Unity 4.6 UI - Image type conflict 1 Answer

Canvas Scaler appears to crash my game. 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