Game Development Reference
In-Depth Information
Classified intel
In this step, we use AddField("fieldname", "value"); in WWWForm to add the
value and pass it to the server. In this function, fieldname depends on the PHP script
that the programmer has set up.
We can open the HiScore.php file in Chapter8 | PHP that is attached with the project
package, and then we can take a look at the following line:
$action = $_POST[ 'action' ]; //Get request action from
Unity
The word action is the same keyword that we assigned in the AddField() function at
the beginning of the SaveUserData() function:
_wwwForm.AddField("action", "PostScore");
This keyword is the value that we will use to communicate between the Unity script and
PHP script on the web server side.
Note
In this PHP file, I've set up the database using MySQL. So, if you have your own database
set up on MySQL, you can adjust this PHP to point to your database and put the file to your
own web hosting.
To create your custom high score database, you can go to the following link to get free
MySQL hosting: http://www.freemysqlhosting.net .
After you finished registration and got the database name ready, you will see something
like the following screenshot:
Search WWH ::




Custom Search