确定,尝试许多代码和文件后!解决了它:
public void Start()
{
//Adds a listener that invokes the "LockInput" method when the player finishes editing the main input field.
//Passes the main input field into the method when "LockInput" is invoked
termInputField.onEndEdit.AddListener(delegate { LockInput(termInputField); });
}
void LockInput(TMP_InputField input)
{
if (input.text.Length > 2)
{
Debug.Log("Text has been entered");
DoSearch();
}
else if (input.text.Length == 0)
{
Debug.Log("Main Input Empty");
}
}
public void DoSearch()
{
//My Code For Doing Search!
}