ES2Web.Load
Generic Load
public T Load<T>(string tag, ES2Settings settings=null)
Parameters
[table th=”0″]T,”The type of the data we want to load. Must be on the Supported Types list.
tag,”The tag which we want to load.”[/table]
Returns
[table th=”0″]T,”Our loaded data”[/table]
Description
Loads the data of type T from the data downloaded using ES2Web. You must yield ES2Web.Download() before calling this method.
C#
public IEnumerator DownloadEntireFile() { // As we don't specify a tag, it will download everything // within the file 'myFile.txt'. string myURL = "https://www.server.com/ES2.php?webfilename=myFile.txt"; ES2Web web = new ES2Web(myURL); // Start downloading our data and wait for it to finish. yield return StartCoroutine(web.Download()); if(web.isError) { // Enter your own code to handle errors here. // For a list of error codes, see www.moodkie.com/easysave/ES2Web.ErrorCodes.php Debug.LogError(web.errorCode + ":" + web.error); } // Use ES2Web.Load(string tag) to load our data. int data = web.Load<int>("myTag"); }
JS
function DownloadEntireFile() { // As we don't specify a tag, it will download everything // within the file 'myFile.txt'. var myURL = "https://www.server.com/ES2.php?webfilename=myFile.txt"; var web = new ES2Web(myURL); // Start downloading our data and wait for it to finish. yield StartCoroutine(web.Download()); if(web.isError) { // Enter your own code to handle errors here. // For a list of error codes, see www.moodkie.com/easysave/ES2Web.ErrorCodes.php Debug.LogError(web.errorCode + ":" + web.error); } // Use ES2Web.Load(string tag) to load our data. var data = web.Load.<int>("myTag"); }
Self-Assigning Load
public T Load(string path, T component, ES2Settings settings=null)
Parameters
[table th=”0″]tag,”The tag which we want to load.”
component,”The Component we want to assign our loaded data to. Must be in the Supported Types list.[/table]
Description
Self-Assigning Load. Loads the Component of type T from the specified tag and automatically assigns it to our Component.
C#
public IEnumerator DownloadEntireFile() { // As we don't specify a tag, it will download everything // within the file 'myFile.txt'. string myURL = "https://www.server.com/ES2.php?webfilename=myFile.txt"; ES2Web web = new ES2Web(myURL); // Start downloading our data and wait for it to finish. yield return StartCoroutine(web.Download()); if(web.isError) { // Enter your own code to handle errors here. // For a list of error codes, see www.moodkie.com/easysave/ES2Web.ErrorCodes.php Debug.LogError(web.errorCode + ":" + web.error); } // Use ES2Web.Load(string tag) to load our data. web.Load<Transform>("myTag", this.transform); }
JS
function DownloadEntireFile() { // As we don't specify a tag, it will download everything // within the file 'myFile.txt'. var myURL = "https://www.server.com/ES2.php?webfilename=myFile.txt"; var web = new ES2Web(myURL); // Start downloading our data and wait for it to finish. yield StartCoroutine(web.Download()); if(web.isError) { // Enter your own code to handle errors here. // For a list of error codes, see www.moodkie.com/easysave/ES2Web.ErrorCodes.php Debug.LogError(web.errorCode + ":" + web.error); } // Use ES2Web.Load(string tag) to load our data. web.Load.<Transform>("myTag", this.transform); }