I am trying to get my on clicked functions for my buttons to get the right index from an array and get its corresponding element from that array. But I seem to get a blank/zero input for every second index for the indices of both my array variables. I have a string array variable and an integer array variable. If the user enters:
pig 80, ant 20, wolf 240, bird 35, lizard 65
I have Button 1 to read index 0, which is pig 80, and it does so as intended.
But I have Button 3, for example, to read index 2, which should be wolf 240. But instead I get ant 20, which should be in index 1 linked to Button 2.
And I end up getting wolf 240 in Button 5 instead of Button 3.
And Buttons 2 and 4 end up blank/0.
So I am guessing that after the first input, each time the user enters each input, a blank/0 gets entered into the array before the committed text does. But I am not sure why. Please look below.
I am not sure if this problem has anything to do with the me binding editable text as follows;
I did this because I want the editable text box to get wiped when the text is committed. If I don’t bind the editable text box to anything, then the entry in the editable text box remains and each time the user adds another entry he/she has to delete the previous entry first.
Or perhaps is there something wrong with my On Text Committed scripting? (below);