So, I am new to unity and I am trying to follow a tutorial, In the tutorial, they are trying to get the text of an input field however when I try it I get the error:
'GameObject' does not contain a definition for 'text' and no accessible extension method 'text' accepting a first argument of type 'GameObject' could be found (are you missing a using directive or an assembly reference?)
My code looks like this:
[SerializeField] private GameObject UsernameInput;
...
Debug.Log(UsernameInput.text);
I have added my UsernameInput
like so:
MyImage
I have looked at this but it doesn't help.
Any help would be greatly appreciated.