Saving and Loading from Web in Playmaker

Examples of using Easy Save 2 Playmaker actions to save and load.
Post Reply
User avatar
Joel
Moodkie Staff
Posts: 4810
Joined: Wed Nov 07, 2012 10:32 pm

Saving and Loading from Web in Playmaker

Post by Joel »

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.
Attachments
Playmaker Web Example.unitypackage
Saving and Loading from Web using Playmaker Example
(10.97 KiB) Downloaded 4664 times
mweyna
Posts: 4
Joined: Thu Feb 06, 2014 3:39 pm

Re: Saving and Loading from Web in Playmaker

Post by mweyna »

Has this tutorial been updated to the latest version of Unity? When I open it I get a lot of missing actions.
User avatar
Joel
Moodkie Staff
Posts: 4810
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving and Loading from Web in Playmaker

Post by Joel »

Hi there,

We'll add an update to this tutorial on Monday to represent the Playmaker update on the current release.

All the best,
Joel
User avatar
Joel
Moodkie Staff
Posts: 4810
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving and Loading from Web in Playmaker

Post by Joel »

This example is now up to date. You may need to update your Playmaker action with the one provided in the latest version of Easy Save 2.

All the best,
Joel
paul4tune
Posts: 8
Joined: Wed Feb 25, 2015 12:13 am

Re: Saving and Loading from Web in Playmaker

Post by paul4tune »

the saving and loading for web guide doesn't show where to upload the ES2.php file to the server could you explain thanks
User avatar
Joel
Moodkie Staff
Posts: 4810
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving and Loading from Web in Playmaker

Post by Joel »

Hi Paul,

Anywhere on your web server will do, as long as you can get a URL to it.

All the best,
Joel
Post Reply