Saving and Loading from Web in Playmaker
Posted: Wed Nov 20, 2013 3:53 pm
Saving and Loading from Web In Playmaker
In this example we will save and load a Vector3 from a MySQL server using Easy Save's Playmaker actions. See the bottom of this post for the UnityPackage containing the files for this example.
Setup
First you will need to set up the Easy Save 2 MySQL and PHP functionality on your server, using the Web Setup instructions in the Saving and Loading from Web Guide.
Saving to Web
We save to web using the Easy Save 2/Upload actions (in this example we use the Upload Vector3 action). We're saving on APPLICATION QUIT, though you could also save when a button is pressed or at any other suitable time.
In the Upload action, hover over each label to see what each field does. You should enter your own unique name in the Tag field, such as the name of the variable you are saving.
If an error is thrown, our example goes to the IsError state. For a list of errors and error codes, see the Error Codes section of the Saving and Loading from Web guide.
Loading from Web
We load from web using the Easy Save 2/Download actions (in this example we use the Download Vector3 action). We're saving as soon as the FSM becomes active, though as with saving you could also save when a button is pressed or at any other suitable time.
In the Download action, you can again hover over each label to see what each field does. When loading you should use the same Tag as you used when saving the data.
Again, if an error is thrown, our example goes to the IsError state. For a list of errors and error codes, see the Error Codes section of the Saving and Loading from Web guide.
It should also be noted that an error will be thrown if there is no data to load. In this case, error code 05 will be thrown.
Delete From Web
There is also a Delete From Web action which works in the same way as the Upload and Download actions. Use this to delete data from your server.
In this example we will save and load a Vector3 from a MySQL server using Easy Save's Playmaker actions. See the bottom of this post for the UnityPackage containing the files for this example.
Setup
First you will need to set up the Easy Save 2 MySQL and PHP functionality on your server, using the Web Setup instructions in the Saving and Loading from Web Guide.
Saving to Web
We save to web using the Easy Save 2/Upload actions (in this example we use the Upload Vector3 action). We're saving on APPLICATION QUIT, though you could also save when a button is pressed or at any other suitable time.
In the Upload action, hover over each label to see what each field does. You should enter your own unique name in the Tag field, such as the name of the variable you are saving.
If an error is thrown, our example goes to the IsError state. For a list of errors and error codes, see the Error Codes section of the Saving and Loading from Web guide.
Loading from Web
We load from web using the Easy Save 2/Download actions (in this example we use the Download Vector3 action). We're saving as soon as the FSM becomes active, though as with saving you could also save when a button is pressed or at any other suitable time.
In the Download action, you can again hover over each label to see what each field does. When loading you should use the same Tag as you used when saving the data.
Again, if an error is thrown, our example goes to the IsError state. For a list of errors and error codes, see the Error Codes section of the Saving and Loading from Web guide.
It should also be noted that an error will be thrown if there is no data to load. In this case, error code 05 will be thrown.
Delete From Web
There is also a Delete From Web action which works in the same way as the Upload and Download actions. Use this to delete data from your server.