here is the onsubmit method, however this is not exposed in the editor, only onvaluechanged, onselect, onendedit, ondeselect are exposed.
I would be ok to use onendedit, however I use this inputfield for a chatbox and if the user presses ESCAPE to abort his chat, currently onendedit will still trigger and the message gets sent. I want something that is only triggered when the user pressed ENTER, and I guess this would be covered by onsubmit however its not being exposed in the inspector for some reason.
Any advice appreciated. Thanks.
You will have to add this with code. Heres a one line way to make stuff happen when they submit.
Start()
{
GetComponent<TMP_InputField>().onSubmit.AddListener((string input)=>{DoThing();});
}
Easier to understand version...
public TMP_InputField MyInputfield
Start()
{
MyInputfield.onSubmit.AddListener(DoStuffWhenSubmitted);
}
void DoStuffWhenSubmitted(string input)
{
// do stuff here
}