Setting string to 'entire' contents of input field?
Simple question here.
I'm trying to set a string variable to the contents of of an InputField, using
string messageBody;
InputField messageInput;
MyMethod()
{
messageBody = messageInput.text
//do more stuff with messageBody string
}
Which works except this only seems to pull the text displayed within the input field, as opposed to the entire contents. I.e. if my input message is too long to fit into the input box it only sets the displayed portion as string. If I move the cursor to the end I get the end of the text, likewise, moving the cursor to show the beginning or middle displays the respective portion of the text. Resizing gives more or less of the text, but I cant seem to get the entire contents set to the string.
I'm sure this is a simple solution but I just can't figure out what I need to change, it looks right according to the docs, any help is appreciated
Your answer
![](https://koobas.hobune.stream/wayback/20220612201921im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
C# Enable component on another GameObject using name of component 1 Answer
How to change value of another gameobject through script 2 Answers
Set a variable from another script 1 Answer
Interchangeable animations in a script? 0 Answers
The variables modified in the inspector are not kept on build 0 Answers