ES2.LoadArray
Load Array
Parameters
T | The type of the data in the array 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
T[ ] | Our loaded array. |
Description
Loads an native array containing data of type T from the specified path.
C#
1 2 3 4 5 6 |
// Create an array of strings and save it. string[] stringArray = new string[]{"String1", "String2", "String3"}; ES2.Save(stringArray, "myFile.txt?tag=stringArray"); // Load the string array and re-assign it to our stringArray variable. stringArray = ES2.LoadArray<string>("myFile.txt?tag=stringArray"); |
JS
1 2 3 4 5 6 |
// Create an array of strings and save it. var stringArray = ["String1", "String2", "String3"]; ES2.Save(stringArray, "myFile.txt?tag=stringArray"); // Load the string array and re-assign it to our stringArray variable. stringArray = ES2.LoadArray.<String>("myFile.txt?tag=stringArray"); |
Self-Assigning Load Array
Parameters
T | The type of the data in the array 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 an native array containing data of type T from the specified path, into the values in the array provided as a parameter.
The array 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. 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.LoadArray<Transform>("myFile.txt?tag=stringArray", transforms); |
JS
1 2 3 4 5 6 7 |
// Get an array of Transforms and save them. var transforms : 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.LoadArray.<Transform>("myFile.txt?tag=stringArray", transforms); |