Author Topic: GUI Back Button Leading to Different Previous Menus  (Read 5002 times)

uberwleiss

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
GUI Back Button Leading to Different Previous Menus
« on: October 30, 2013, 10:57:30 AM »
Hello,

I'm new to NGUI and was wondering, what would be the best way to achieve this:

-I have a menu, let's call it "Upgrade" menu which can be called from various other menus in the project. From Main Menu, from Pause Menu, from LevelFinished Menu etc...
-This Upgrade Menu has a Back button which should lead to the Menu from which the Upgrade Menu was called.

Before NGUI, I'd simply check which menu was the previos one with a simple int variable (main menu = 1, pause menu = 2, game menu = 3 etc). I've tried this approach but I can't pass an argument with NGUI button message.

I have various solutions for this in mind but all of them seem a bit clunky and unnecessary complicated.

One more note, I'm a self-taught UnityScript scripter. My main expertise is 3D graphics and animation but I had to learn scripting since I couldn't find anyone in my area willing to cooperate. I have absolutely no formal background in programming.

Cheers

Darkmax

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 93
    • View Profile
Re: GUI Back Button Leading to Different Previous Menus
« Reply #1 on: October 30, 2013, 06:06:34 PM »
mm you can set a public variable with this number method that you mention and then use this variable when the user click the back button to load the corresponding menu.

I used something like this, for a past project, and it works great.

uberwleiss

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: GUI Back Button Leading to Different Previous Menus
« Reply #2 on: October 30, 2013, 06:55:00 PM »
Hello,

Thank you for your reply. I've solved it just now. There are various ways to solve it but I thought that there might be something in NGUI already.

I've just used a static variable for a current menu ID, as I've did before, remembering which menu was the previous one and then used those numbers to toggle corresponding NGUI tweens, that is, fading/scaling/moving the current menu out of the way and fading-in/moving/scaling the previous menu into the view.

Thanx