I’m pretty new to Unity and when talking to my friend, decided to make a miniature calculator than can calculate Σ using a for loop, so I can learn C# better. That’s not the hard part, however; I’m really struggling with the TMP InputFields. Your input is the parameter in the function you call, correct? I set the Content Type to integer, but it’s still returning a string, and I get “FormatException: Input string was not in a correct format.
System.Number.ThrowOverflowOrFormatException (System.Boolean overflow, System.String overflowResourceKey” whenever I try to run my simple script. My code’s a mess because I have been testing out many things, such as /u200B(which is quite confusing), but can someone please check it out and tell me what I’m doing wrong? Thank you so much!
public class InputReader : MonoBehaviour
{
private int topInput;
public void ReadTopInput(string s)
{
//s = s.Replace("\u200B", "");
topInput = int.Parse(s);
//topInput = s.;
Debug.Log(topInput);
}
}
The goal is simply, for now, to log my topInput in the console. I need it to be an integer for later calculations. Thanks again!