#float/int parsing from TMPro input fields

1 messages · Page 1 of 1 (latest)

coarse frigate
#

so i try to parse input from tmpro input fields but it keeps erroring about it not being in a usable string format


public void readanddisplaydata()
{

buff_block bufftosend = new buff_block
{

damagebuff = float.Parse(inputfields[0].text),
penetrationbuff = float.Parse(inputfields[1].text),
accuracybuff = float.Parse(inputfields[2].text),
effectareabuff = float.Parse(inputfields[3].text),
clipsizebuff = int.Parse(inputfields[4].text),
reloadspeedbuff = float.Parse(inputfields[5].text),
Dotchancebuff = float.Parse(inputfields[6].text),
Dotdamagebuff = float.Parse(inputfields[7].text),
dottickbuff = int.Parse(inputfields[8].text),
turretspeedbuff = float.Parse(inputfields[9].text),
cannonspeedbuff = float.Parse(inputfields[10].text),
speedbuff = float.Parse(inputfields[11].text),
turningbuff = float.Parse(inputfields[12].text)
};
 
````
i use this method
lethal forum
#

You should really be validating the input