Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - cpt_barricade

Pages: [1]
1
NGUI 3 Support / Unable to Set Focus on a Button with UIButtons
« on: March 22, 2014, 12:36:28 PM »
Hi folks, I was hoping to get some help on using NGUI as a pause menu. Before I jump into the problems I'm having I'll do a quick runthrough of how I've gotten the pause menu into the scene.

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class PauseGame : MonoBehaviour
  5. {
  6.         // Boolean used to toggle pause and play.
  7.         private bool pauseGame;
  8.         private GameObject pauseScreen;
  9.         void Start ()
  10.         {
  11.                 // By default the game should not be paused.
  12.                 pauseGame = false;
  13.                 // Load the pause prefab into the scene.
  14.                 pauseScreen = (GameObject)Instantiate(Resources.Load("PauseMenu"));
  15.                 // Set the pause screen to invisible until the pause button is pressed.
  16.                 pauseScreen.SetActive(false);
  17.                 // Game proceeds normally when timeScale = 1.
  18.                 Time.timeScale = 1;
  19.  
  20.                 // Disable seeing the cursor on-screen
  21.                 Screen.showCursor = false;
  22.         }
  23.        
  24.         void Update ()
  25.         {
  26.                 if(Input.GetButtonDown("Pause"))
  27.                 {
  28.                         // Either pause or unpause the game.
  29.                         // If the game isn't paused i.e. the player is playing, pause the game.
  30.                         if(pauseGame == false)
  31.                         {
  32.                                 pauseScreen.SetActive(true);
  33.                                 pauseGame = true;
  34.                                 Time.timeScale = 0;
  35.                                 Screen.showCursor = true;
  36.                         }
  37.                         // If game is paused and the pause button is pressed again, unpause.
  38.                         else if(pauseGame == true)
  39.                         {
  40.                                 pauseScreen.SetActive(false);
  41.                                 pauseGame = false;
  42.                                 Time.timeScale = 1;
  43.                                 Screen.showCursor = false;
  44.                         }
  45.                 }
  46.         }
  47. }
  48.  

Basically when the user presses the pause button the pause screen prefab is shown. I'm running into a fairly annoying problem that's affecting controller support, namely:

  • I have the UIButton Keys script attached to my pause menu with the "Resume game" button listed as "start targeted". For some reason this isn't working, however. I think it may have something to do with the way I activate it - "pauseScreen.setActive(true)". Is this the correct way to call my pause screen?

Any help on this matter would be greatly appreciated. I have the funny feeling this problem is a result of my inexperience with NGUI.

2
NGUI 3 Support / Re: NGUI Labels Showing Lines in-game
« on: March 05, 2014, 02:21:23 PM »
That thought completely slipped my mind. Looks like the problem was entirely on my end and not on NGUI(Not that it could even be seen as a "problem"). Thanks for the help Nicki!

3
NGUI 3 Support / NGUI Labels Showing Lines in-game
« on: March 05, 2014, 01:58:34 PM »
Hi guys,

I took a look through some of the more recent threads but wasn't able to see anything related to my issue. I've run into a graphical issue with labels in NGUI where the labels are showing the invisible area around it (I'm not really sure how to describe it but I've attached an image, the white bars around the labels, most apparent on buttons).

I was wondering if there was a fix for this? I've tried updating, re-downloading and re-importing the NGUI package into the project with no luck and the NGUI package itself seems to work fine in a new project. No errors have been thrown relating to NGUI in the project(Or any errors for that matter). I stopped working on my menus to focus on coding my game a week ago and at that point it was fine. Any help would be greatly appreciated!

Pages: [1]