int.TryParse is not working for me, any suggestions?

Hey everyone, I’ve been trying for an hour now with every variation I could think of or look up. I’ve looked through Answers, and a ton of other resources; but now I come to you.

My app is essentially a digital baseball scorecard. For every inning there is an InputField for the user to input the opponent score for that inning, and the code below is trying to take the inputfield text (a number) and convert it to an int so that I can add them up together to find a total score.

Any suggestions are hugely appreciated, thank you!

   public void CalculateTotalOpponentScore(int inningSubmitted)
        switch (inningSubmitted)
            case 1:
                if (int.TryParse(opponentScoreFields[inningSubmitted - 1].text, out int result))
                    totalOpponentScore += result;
                    Debug.Log("TryParse Successful.");
                    Debug.Log("TryParse Failed.");

        txt_opponentTotalScore.text = totalOpponentScore.ToString();

TryParse() and Parse(), work just fine. Recommend to read up on this post:

However, there is a faster method(but unfortunately does not check for errors) which is the hard coded version, that I use:

public static int StringToInt(string s)
        int y = 0;
        for (int i = 0; i < s.Length; i++)
            y = y * 10 + (s *- '0');*

return y;
But like I said, it is prone to errors, if the string you are passing through it contains any letters or symbols. In my case, I know for sure every instance I pass through this function is only number values(in string format).
* if your string does contain letters, research into SubString() method…
Hope this helps!