Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: puneetk on November 05, 2014, 12:37:03 PM

Title: NGUI Button to activate/deactivate some other buttons?
Post by: puneetk on November 05, 2014, 12:37:03 PM
Hi I'm trying to make a "settings" button which on click shows two other buttons that is a sound and music button. When you click settings again, the sound and music button should disappear.

Any way to do this using the preprovided ngui toolset?
Title: Re: NGUI Button to activate/deactivate some other buttons?
Post by: ArenMook on November 06, 2014, 01:58:10 AM
  1. using UnityEngine;
  2.  
  3. public class Toggle : MonoBehaviour
  4. {
  5.     public GameObject activate;
  6.     void OnClick () { activate.SetActive(!activate.activeSelf); }
  7. }
Title: Re: NGUI Button to activate/deactivate some other buttons?
Post by: puneetk on November 06, 2014, 04:09:34 PM
Thanks, is there also a way to set UIToggle script to work onPress or onHover?

Basically, I have another button, that shows another sprite when you press it (using UItoggle and selecting the other sprite), and I want another Panel to show, once the button is released.

How do I get this to work?
Title: Re: NGUI Button to activate/deactivate some other buttons?
Post by: ArenMook on November 07, 2014, 02:05:22 PM
No, toggle works with OnClick. If you want it to be something else, write your own simple script. Take the script I created in the previous reply and change OnClick to OnPress (bool isPressed) for example.