- Home /
4.6.0 InputField help
My question is probably a stupid one but I can't find answers anywhere, I need to be able to retrieve the string value from an InputField in my scene and assign it to a variable. The problem is that I have no clue how to reference this string value in code. I code in JavaScript incase that means any thing
Answer by Umresh · Jan 05, 2015 at 11:50 AM
Make a public variable and add text component to this variable and get the text component's text value.
public Text inputFieldTextComponent;
string inputText;
void Start()
{
inputText = inputFieldTextComponent.text;
}
Your answer
Follow this Question
Related Questions
Get information from variable 1 Answer
Unity C# help for beginners tutorial needed (Urgent) 2 Answers
how to trigger another script in unityscript 1 Answer
Creating a 2D sidescroller, anyone know any sprite sheet tutorials? 1 Answer
I need to create an explosion in front of a charactor controller. 0 Answers