Setting a float from Input Field

Hi! So I am creating a simple workflow calculating program. It is supposed to let you input a 4 step workflow, the time for each step. calculate the overall time and estimate an average based on previous times of separate steps.

Firstly. Should i do it using the input field? If yes, could someone give me a short explaination on how to set the input field to do that(No code required, just a simple explaination to get me going).

Secondly. If the input field is not the way to go, which thing should be used, if there is a code for setting in an input field. Give me just a hint. I would like to figure it out by myself mostly.

there is no setting to exclude letters or Non-numbers from an input field in unitys GUI system. You would do it manually with code. your input field should be attached to a string variable.
there a couple ways to do it. you could loop through the input string to see if the keys are contained in the characters “1234567890” and remove it if it doesn’t match. this is a good method that can limit a field to Any characters you specify. if you’re expecting numbers, when the field is submitted you simple use TryParce to convert to an int.

or another simpler approach for numbers would be, everytime the input field changes you could use Tryparce to see if you get a number, if you don’t get a number you would simply revert it back to what the field was the frame before.

you should be able to do both checks in just a few lines of code. if you want code example let me know.