Unity3d Clear input fields after submitting in C#

2.9k views Asked by At

I have a panel that has various input fields. When the user submits the information, it is saved in an SQLite database. I'd like to clear the fields once the info is submitted, but simply setting the string to "" doesn't work.

FieldText.text="";

What's the best way to clear them out? Thanks!

2

There are 2 answers

1
Cristiano Soleti On BEST ANSWER

Is that called when you submit? Are you sure? Try to Log when you submit , if it does that .text="" ; should work

0
Ken Gordon On

To solve this, I had to use make a separate variable of type InputField, then I had to set that with a .text to "".

So-

InputField field
field.text="";

After submit, the function was called to clear the field and it worked! Thanks guys!