Example #1
0
    void SavetoJson()
    {
        Debug.Log("saving value " + text_to_json.text + " to user.json");

        writejson obj = this.GetComponent <writejson>();

        TextPair textpair = new TextPair();

        textpair.name = text_to_json.text;
        textpair.type = "input";

        obj.SaveJson("user.json", textpair);

        TextPair status = loadjson.LoadJsonFromFile("user.json");

        Debug.Log(status.name);
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.S))
        {
            writejson obj = this.GetComponent <writejson>();

            TextPair textpair = new TextPair();

            textpair.name = "oaishi";
            textpair.type = "input";

            obj.SaveJson("Test01.json", textpair);
        }

        if (Input.GetKeyDown(KeyCode.L))
        {
            TextPair status = loadjson.LoadJsonFromFile("Test01.json");
            //Debug.Log(status);
        }
    }