Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: TicTac on October 06, 2013, 08:34:49 AM

Title: Linking Input to Button
Post by: TicTac on October 06, 2013, 08:34:49 AM
Hello, I'm new to NGUI  and Unity in general. I really like what I see with NGUI and I'm trying to sort out profiles for a game I'm developing but I am having problems. Basically what I wan't is for my Inputs from two text boxes to be sent to my create new profile script when a button is pressed. Currently I have a script on each input that reads content of each input, I was then trying to reference them using get component from my create profile but I'm struggling to do so. I feel like I'm missing a trick here! :)
Title: Re: Linking Input to Button
Post by: ArenMook on October 06, 2013, 10:16:21 PM
Have a script like this on the button:
  1. public class MyHandler : MonoBehaviour
  2. {
  3.     public UIInput inputA;
  4.     public UIInput inputB;
  5.  
  6.     void OnClick()
  7.     {
  8.         Debug.Log(inputA.value + ", " + inputB.value);
  9.     }
  10. }
Don't forget to drag & drop the values in inspector after attaching this script to your button.
Title: Re: Linking Input to Button
Post by: TicTac on October 07, 2013, 11:59:29 AM
Cool, this looks like its working however I think because I am using the free version .value is not working? if so is there a way around it? I plan to update to the full version soon but for now it would be useful to have it working!
Title: Re: Linking Input to Button
Post by: Darkmax on October 07, 2013, 12:35:27 PM
I think instead of value is text