Beispiel #1
0
    public void SaveToJson()
    {
        saveCost = FindObjectOfType <CostSystem>();
        InitJson();

        if (saveCost.RecipeList.Count != 0)
        {
            string jsonWrite = JsonUtility.ToJson(saveCost);
            File.WriteAllText(path, jsonWrite);
        }
        else
        {
            Debug.Log("One of More of the Lists are Empty");
        }
    }
Beispiel #2
0
    void OnGUI()
    {
        findJson   = FindObjectOfType <SerializeJson>();
        findRecipe = FindObjectOfType <CostSystem>();

        // Window Code
        GUILayout.Label("Load Json Files", EditorStyles.boldLabel);
        if (GUILayout.Button("Load"))
        {
            findJson.InitJson();
            findRecipe.InitRecipes();
        }

        GUILayout.Label("Save Json Files", EditorStyles.boldLabel);
        if (GUILayout.Button("Save"))
        {
            findJson.SaveToJson();
        }
    }
Beispiel #3
0
 // Start is called before the first frame update
 void Start()
 {
     findJson   = FindObjectOfType <SerializeJson>();
     findRecipe = FindObjectOfType <CostSystem>();
     Load();
 }