- Home /
How to make a 2d gui that can go down??
Hi I want a simple 2gui text for example i hit a pause button than the pause come down from upstairs because i dont want to make a new scene. Hope you anderstand this sorry bad english. I make a screen shot from a other game !
Things like this are fairly easy to do in third-party GUI systems line NGUI and EZGUI. Rumor has it that Unity will soon have a new GUI system based on NGUI. But doing this with existing GUI stuff in Unity can be difficult (I$$anonymous$$HO). You can build it out of scene displayed to a second camera (which is what EZGUI and NGUI do), or perhaps you can get want you want using GUITexture objects.
how can i make with NGUI and EZGUI a gui that come down??
I can only speak to EZGUI. On the parent object of your controls built with EZGUI, you can attach a Bi-State Interactive Panel script. Take a look at the EZGUI showcase video to get an idea of what you can do:
http://www.anbsoft.com/middleware/ezgui/ez_gui_showcase/index.html
You will see some menu's sliding in starting around the 1:00 mark.
But considering that NGUI-like functionality will soon be part of Unity, NGUI would likely be the better way to go.
Answer by karenkrane · Mar 03, 2014 at 07:04 PM
I'm not sure what you mean by "go down"... move down the screen? You would just put hte code in a separate function:
 using UnityEngine;
 using System.Collections;
 
 public class Pause : MonoBehaviour {
     
     public bool isPaused= false;
     GUIStyle pauseStyle;
     Texture pausePopUp;
     
     void  OnGUI (){
         
         
         
         if (GUI.Button ( new Rect(50, 50, 150,65), " ", pauseStyle))
         {
             
             Time.timeScale = 0;
             isPaused = true;
             
         }
         
         
         
         if(isPaused)
         {
             //show the popup pause menu or new location of the existing pause button here...
             if(GUI.Button( new Rect(10, 10, 700,700), pausePopUp))
             {
             //click the new button to turn off pause
                 isPaused = false;
             }
             
         }
     }
 }
yes but i want not draw a gui Label or button i want a picture like a menu that come from upstairs and come down. like venetians.
Edit: so now i find another way how can i make this one but ein problem is there i want this when i pushh the gui texture but how can i do this?? using UnityEngine; using System.Collections;
 public class gui : $$anonymous$$onoBehaviour {
 
 
     
     public GameObject[] pauseElements;          //The pause menu elements
     bool showPause            = false;            //The pause showed
     bool canClick            = true;                //The player can click
 
 
 
 
 
     void Update()
     {
                 if (Input.Get$$anonymous$$eyDown ($$anonymous$$eyCode.P)) {
 
                     
                         //Show the pause GUI element
                         StartCoroutine ($$anonymous$$ove$$anonymous$$enu (pauseElements [1].transform, 0, 3, 0.45f, false));
                             }
 
         if (Input.Get$$anonymous$$eyDown ($$anonymous$$eyCode.A)){
 
             
             //Show the pause GUI element
             StartCoroutine ($$anonymous$$ove$$anonymous$$enu (pauseElements [0].transform, 0, 6, 0.45f, false));
 
                 }
         }
 
 
 
 
 
     //$$anonymous$$oves a selected menu item to a specified space with speed
     IEnumerator $$anonymous$$ove$$anonymous$$enu(Transform menuTransform, float endPosX, float endPosY, float time, bool hide)
     {
         canClick = false;
         
         //$$anonymous$$ove the menu to the designated position under time
         float i = 0.0f;
         float rate = 1.0f / time;
         
         Vector3 startPos = menuTransform.localPosition;
         Vector3 endPos = new Vector3(endPosX, endPosY, menuTransform.localPosition.z);    
         
         while (i < 1.0) 
         {
             i += Time.deltaTime * rate;
             menuTransform.localPosition = Vector3.Lerp(startPos, endPos, i);
             yield return 0;
         }
 
 
     }
 
     
 }
 
 
 
 
 
 
     
Your answer
 
 
             Follow this Question
Related Questions
Halt function midway until player presses 'OK' then continue 1 Answer
GUI Buttons not working after scene transition 0 Answers
Paused Menu backdrop 1 Answer
How to pause a game with a GUI button 1 Answer
Pause Menu - Loading & Quitting 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                