How to detect the length of an input field [C# noob]

Hello,

I’d like a button to pop up when an input field has at least 1 character in it. I’m struggling with the syntax; everything I try gives me a:

“NullReferenceException: Object reference not set to an instance of an object”

I tried using .Length but suspect that that only works for strings. So I tried to use .ToString to convert to something that can use .Length but am not having any luck with that approach either.

What steps/conversions do I need to follow/implement?
An example with C# syntax would be ideal.

Thanks in advance,

Best regards,
Don

// Add UI namespace

using UnityEngine.UI;

Setup references to myInputField and myButton. In the Editor, drag&drop these UI elements from hierarchy into script fields that will show up; alternatively use GameObject.Find, private [SerializeField] field, etc…

public InputField myInputField;
public Button myButton;

In Update (or similar)

if (myInputField.text != "") {
myButton.SectActive(true);
}