Does this saving system have any major flaws?

I am working on creating a saving system for my game, and I think that it is going well, but I was wondering if there are any major flaws with this system. I am saving data as Dictionaries, so that I can reference a specific character from all characters, or a specific object in the scene etc. Will there be any clear issues with this?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO; //Using statement for system processes. (such as creating files)
using Newtonsoft.Json; //Using statement for newtonsoft serializer.

public class SaveControlScript : MonoBehaviour
{
   
    [Header("Save File")]
    public int selectedSaveFile; //An integer value for the save file we are saving into with the string version of the Json data.
    public string[] statsJSON; //The json string for all of the saved values. (array to be used for multiple save slots)

    [Header("Saved Dictionaries")]
    public Dictionary <string, Stats> savedStats; //A dictionary for the saved player stats. It has a key value and a returned value.
   

    public void Save() //Function saves all stats to a json string, which it then writes to a json file.
    {
      
        //Serialize data to Json.

        WriteSaveIntoJSON(); //Write the json string into the json file.
    }

    public void LoadGame() //Function loads save data from json file, and writes that data to our current values when asked.
    {
        LoadSaveFromJSON(); //Load the save data from the json file.
        //Deserialize data from Json.
    }

    public void DeleteGame() //Function to delete a save file. Will only run if the file exists.
    {
        if (File.Exists (Application.persistentDataPath + @"\" + "SaveFile" + selectedSaveFile + ".json"))
        {
            File.Delete (Application.persistentDataPath + @"\" + "SaveFile" + selectedSaveFile + ".json");
        }
    }

    public void NewGame() //Function for starting a new game with base stats.
    {
        //Reset game data to default.
    }

    public void WriteSaveIntoJSON() //Function for writing the stats into a json file. If the file exists, write it into the file, otherwise create a file, and then write it in.
    {
        if (System.IO.File.Exists (Application.persistentDataPath + @"\" + "SaveFile" + selectedSaveFile + ".json"))
        {
            System.IO.File.WriteAllText(Application.persistentDataPath + @"\" + "SaveFile" + selectedSaveFile + ".json", statsJSON[selectedSaveFile]);
        }else
        {
            System.IO.File.Create (Application.persistentDataPath + @"\" + "SaveFile" + selectedSaveFile + ".json").Dispose(); //Dispose = Dispose of path.
            System.IO.File.WriteAllText(Application.persistentDataPath + @"\" + "SaveFile" + selectedSaveFile + ".json", statsJSON[selectedSaveFile]);
        }
       
    }

    public void LoadSaveFromJSON() //Function for loading the stats from a json file. Checks if the file exists, and if so, loads it, otherwise, it returns.
    {
        if (System.IO.File.Exists (Application.persistentDataPath + @"\" + "SaveFile" + selectedSaveFile + ".json"))
        {
            statsJSON[selectedSaveFile] = System.IO.File.ReadAllText((Application.persistentDataPath + @"\" + "SaveFile" + selectedSaveFile + ".json"));
        }else
        {
            return;
        }
    }
}

There is a TON of repeated code!

This expression appears (I believe) eight (8) times!

Something of that complexity should appear in ONE place only.

This has nothing to do with the save system itself, but my goodness, you should NEVER repeat the same computation again and again and again.

Otherwise, if it works it works. Here’s some more notes:

Load/Save steps:

https://discussions.unity.com/t/799896/4

An excellent discussion of loading/saving in Unity3D by Xarbrough:

https://discussions.unity.com/t/870022/6

Loading/Saving ScriptableObjects by a proxy identifier such as name:

https://discussions.unity.com/t/892140/8

When loading, you can never re-create a MonoBehaviour or ScriptableObject instance directly from JSON. The reason is they are hybrid C# and native engine objects, and when the JSON package calls new to make one, it cannot make the native engine portion of the object.

Instead you must first create the MonoBehaviour using AddComponent() on a GameObject instance, or use ScriptableObject.CreateInstance() to make your SO, then use the appropriate JSON “populate object” call to fill in its public fields.

If you want to use PlayerPrefs to save your game, it’s always better to use a JSON-based wrapper such as this one I forked from a fellow named Brett M Johnson on github:

Do not use the binary formatter/serializer: it is insecure, it cannot be made secure, and it makes debugging very difficult, plus it actually will NOT prevent people from modifying your save data on their computers.