How to use the InputField to output to the console?

5df2793540163912386269.png
I need to get text from a input field UI from the menu in-game and not pre-specified string.
public void OnSubmitName(string Name)
{
Debug.Log(Name);
 }

Is there any option to do this from the menu itself Unity?
April 3rd 20 at 17:42
2 answers
April 3rd 20 at 17:44
Try this
using UnityEngine.UI;
...
public InputField Txt;
public void OnSubmitName()
{
Debug.Log(Txt.text);
}
...

There will appear a field for the InputField will have to add it.
April 3rd 20 at 17:46
After changing the code ceased to display any text)
5df3b1c99cd1d477855468.png

Find more questions by tags C#Unity Game Engine