Answers for "unity save list to json"

C#
2

unity save list to json

public class MyList {
	public List<T> list;
}

var class = new MyList();
var outputString = JsonUtility.ToJson(class);
File.WriteAllText("C:\\MyFile.json", outputString);

//In reverse, you can deserialize anything doing this:
var inputString = File.ReadAllText("C:\\MyFile.json");
var class = JsonUtility.FromJson<MyList>(inputString);
Posted by: Guest on July-01-2021

C# Answers by Framework

Browse Popular Code Answers by Language