ES2.Load
Generic Load
public static T Load<T>(string path, ES2Settings settings=null)
Parameters
[table th=”0″]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.”[/table]
Returns
[table th=”0″]T,”Our loaded data”[/table]
Description
Loads the data of type T from the specified path.
C#
// 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
// 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
public static T Load(string path, T component, ES2Settings settings=null)
Parameters
[table th=”0″]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.”[/table]
Description
Self-Assigning Load. Loads the Component of type T from the specified path and automatically assigns it to our Component.
C#
// 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
// 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);