1
NGUI 3 Support / tutorial for best-practice hide-and-show UI elements?
« on: June 27, 2014, 11:06:17 AM »
Hi, does anyone know of a really good (artist + limited C#) explanation of hiding and un-hiding NGUI UI elements?
I am using - probably very inefficiently - NGUITools.SetActive(true/false). It has taken me half a day to understand that I need to leave a GameObject higher up the hierarchy 'active' to be able set 'false' items back to 'true' - this is the level I am working at
Any help with writing better code will be much appreciated. Thank you.
I am using - probably very inefficiently - NGUITools.SetActive(true/false). It has taken me half a day to understand that I need to leave a GameObject higher up the hierarchy 'active' to be able set 'false' items back to 'true' - this is the level I am working at
Any help with writing better code will be much appreciated. Thank you.
- public class display : MonoBehaviour {
- public static GameObject selectNpc01Message;
- void Start(){
- }
- void Update() {
- if (GetComponent<triggerNpc01>().triggerActiveNpc01 == true){
- selectNpc01Message = GameObject.Find("selectNpc01");
- NGUITools.SetActive(selectNpc01Message,true);
- if (Input.GetKeyDown("space")){
- Debug.Log("space key was pressed");
- }
- }
- else{
- selectNpc01Message = GameObject.Find("selectMessage");
- NGUITools.SetActive(selectNpc01Message,false);
- }
- }
- }




