Trying to load data to int value

I am trying to overwrite the value of an Int value (known in script as int ObjectCount ) from data stored locally on a computer, and I can’t do that because the value I am trying to overwrite with is a string. Is there any fix for this?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class Main : MonoBehaviour
{
    public GameObject[] myObjects;
    public TextMeshProUGUI textCount;
    int ObjectCount;
    // Start is called before the first frame update
    void Start()
    {
        textCount = GameObject.Find("/Canvas/ObjCount").GetComponent<TextMeshProUGUI>();
    }


    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            int randomIndex = Random.Range(0, myObjects.Length);
            Vector3 randomSpawnPosition = new Vector3(Random.Range(-10, 11), 5, Random.Range(-10, 11));

            Instantiate(myObjects[randomIndex], randomSpawnPosition, Quaternion.identity);
            ObjectCount += 1;
            textCount.text = ObjectCount.ToString();
        }

        if (Input.GetKeyDown(KeyCode.S))
        {
            SaveSystem.SaveCount();
        }

        if (Input.GetKeyDown(KeyCode.L))
        {
            PlayerData data = SaveSystem.LoadData();

            textCount.text = data.ObjectCount.ToString();
        }
    }
}

int.Parse will convert a valid numeric string into an integer. However, you probably want to use TryParse, since that will return a bool telling you whether it is, indeed, a valid numeric string. Check syntax for TryParse, since it uses the out keyword to provide the resulting int.

Along the lines of if (int.TryParse(myString, out myInt))