Its easy to send data to a Online PHP script from your Unity3D game. For this tutorial we are going to use a “Coroutine”. which are extremely handy. So what we are going to do is this
- Send data from the game to a PHP script.
- Using PHP write that data to a file name sent in that data.
- Confirm the data was written.
Ok before we get started we need to create our PHP file, so on your hosting create a new PHP file called “save_player_data.php”
In “save_player_data.php” paste this
Ok we got the PHP sorted out now upload it to your hosting and lets start with Unity3D.
- Firstly create an “New -> Empty Game Object” and call it SaveToPHP.
- Create a new C# script and call it Senddata.
- Paste this C# script into Senddate.cs.
Now save and Drag Senddate.cs and drop onto the Senddata object you created.
Now press Play in Unity and check your hosting (in the same directory and your PHP script) and you should have a new text file called PlayerName.txt, that contains PlayerName,SomeData,
Donate Dogecoins: DGkJRWQCyBUeXbenYz18LRN9X67aora9nz Whats This?