W
W
WarperThe2020-04-20 15:14:16
C++ / C#
WarperThe, 2020-04-20 15:14:16

How to save List to json/xml(Doesn't matter which) file?

You need to save the List to a file.

public class House
    {
        public int FarmId;
       public string FarmName;
        public bool FarmHave;

    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
edward_freedom, 2020-04-20
@WarperThe

Mark a class as serializable AND save
[System.Serializable]

string json = JsonUtility.ToJson(classData);
System.IO.File.WriteAllText("json.json", json);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question