0

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!

Fredrik Widerberg
  • 3,068
  • 10
  • 30
  • 42
Ken Gordon
  • 195
  • 6
  • 20
  • `FieldText.text="";` should work. Otherwise you are using old version of Unity. This is a duplicate of [this](http://stackoverflow.com/a/37754951/3785314) please check that out. If this dos not work then you should post the rest of the code in that script. – Programmer Dec 23 '16 at 03:14
  • Show us a [mvce](http://stackoverflow.com/help/mcve) please. I won't guess. – zwcloud Dec 23 '16 at 07:20
  • I'm using Unity 5.2.3f1, the last version that works on XP. – Ken Gordon Dec 25 '16 at 17:59

2 Answers2

2

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

Cristiano Soleti
  • 805
  • 7
  • 12
0

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!

Ken Gordon
  • 195
  • 6
  • 20