Error: System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) (at <fb001e01371b4adca20013e0ac763896>:0) System.Int32.Parse (System.String s) (at <fb001e01371b4adca20013e0ac763896>:0) ResuelveElProblema.Update () (at Assets/ResuelveElProblema.cs:44) Code: Code (CSharp): public TMP_InputField CasillaUno; public TMP_InputField CasillaDos; [Space(40)] public int intCasillaUno; public int intCasillaDos; void Update() { intCasillaUno = int.Parse(CasillaUno.text); intCasillaDos = int.Parse(CasillaDos.text); } It does not cause any problem in the project, but I would like to know if there is any way that this error does not appear. It's just for sheer aesthetics in the project nomas, thanks.
You are probably reading blank strings from the InputFields which obviously cannot be parsed to int. Just put something like Code (CSharp): if (CasillaUno.text.Length > 0) around the code. Or use int.TryParse instead.
as a general rule of thumb, don't do these things with an if. TryParse exists for a reason. you shouldn't play smart with such things, as it'll blow up in your face eventually. in this particular case doing "34.34.45" or "t348" would still blow up, but hey, I'm not judging