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:
publicclass MyHandler : MonoBehaviour
{
public UIInput inputA;
public UIInput inputB;
void OnClick()
{
Debug.Log(inputA.value+", "+ inputB.value);
}
}
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