ES2.LoadList
Load List
Parameters
T | The type of the data in the List we want to load. Must be on the Supported Types list. |
path |
The path where our data is stored. For more information, see Paths. |
settings |
Optional. A user-created ES2Settings object containing options not specified in path. |
Returns
List<T> | Our loaded List. |
Description
Loads a List containing data of type T from the specified path.
C#
1 2 3 4 5 6 7 8 9 |
// Create a List of int values and save it. List myList<int> = new List<int>(); myList.Add(1); myList.Add(2); ES2.Save(myList, "myFile.txt?tag=myList"); // Load the List and re-assign it to our variable. myList = ES2.LoadList<int>("myFile.txt?tag=myList"); |
JS
1 2 3 4 5 6 7 8 9 |
// Create a List of int values and save it. var myList = new List.<int>(); myList.Add(1); myList.Add(2); ES2.Save(myList, "myFile.txt?tag=myList"); // Load the List and re-assign it to our variable. myList = ES2.LoadList.<int>("myFile.txt?tag=myList"); |
Self-Assigning Load List
Parameters
T | The type of the data in the List we want to load. Must be on the Supported Types list and be a Component/MonoBehaviour. |
path |
The path where our data is stored. For more information, see Paths. |
settings |
Optional. A user-created ES2Settings object containing options not specified in path. |
Description
Loads a List containing data of type T from the specified path, into the values in the List provided as a parameter.
The List provided as a parameter should be the same length as the data we’re loading, and be filled with Components of the same type that we’re loading. The data we’re loading will then be loaded into each of these Components.
C#
1 2 3 4 5 6 7 |
// Get an array of Transforms and save them. List<Transform> transforms = GetTransforms(); ES2.Save(transforms, "myFile.txt?tag=transforms"); // Now load the data we just saved back into the Transforms, // instead of creating new Transforms for each. ES2.LoadList<Transform>("myFile.txt?tag=stringArray", transforms); |
JS
1 2 3 4 5 6 7 |
// Get an array of Transforms and save them. var transforms : List.<Transform> = GetTransforms(); ES2.Save(transforms, "myFile.txt?tag=transforms"); // Now load the data we just saved back into the Transforms, // instead of creating new Transforms for each. ES2.LoadList.<Transform>("myFile.txt?tag=stringArray", transforms); |