ES2.Load
Generic Load
Parameters
T | The type of the data 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 data |
Description
Loads the data of type T from the specified path.
C#
1 2 3 4 5 |
// Save the position of this GameObject. ES2.Save(transform.position, "myFile.txt?tag=myPosition"); // Load the position we saved and assign it to this GameObject. transform.position = ES2.Load<Vector3>("myFile.txt?tag=myPosition"); |
JS
1 2 3 4 5 |
// Save the position of this GameObject. ES2.Save(transform.position, "myFile.txt?tag=myPosition"); // Load the position we saved and assign it to this GameObject. transform.position = ES2.Load.<Vector3>("myFile.txt?tag=myPosition"); |
Self-Assigning Load
Parameters
path | The path where our data is stored. For more information, see Paths. |
component |
The Component we want to assign our loaded data to. |
settings |
Optional. A user-created ES2Settings object containing options not specified in path. |
Description
Self-Assigning Load. Loads the Component of type T from the specified path and automatically assigns it to our Component.
C#
1 2 3 4 5 |
// Save the Transform Component of this GameObject. ES2.Save(transform, "myFile.txt?tag=myTransform"); // Load the Transform we saved and assign it to this GameObject's Transform Component. ES2.Load<Transform>("myFile.txt?tag=myTransform", transform); |
JS
1 2 3 4 5 |
// Save the Transform Component of this GameObject. ES2.Save(transform, "myFile.txt?tag=myTransform"); // Load the Transform we saved and assign it to this GameObject's Transform Component. ES2.Load.<Transform>("myFile.txt?tag=myTransform", transform); |