title: How to store Game state in to the database and load it using php and c# script
body: <p>I have to find a way to Save and Load Game state from Database using c# script and php. So far I'm able to store the player location to my local registry but saving it remotely is the problem. Does anyone know the list of steps i need to implement this?  </p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  using System;
  using System.Runtime.Serialization.Formatters.Binary;
  using System.IO;
  
  public class SaveSystem : MonoBehaviour {
  
      // Use this for initialization
      public void SaveState () {
          BinaryFormatter bf = new BinaryFormatter ();
          FileStream file = File.Create (Application.persistentDataPath + "/PlayerData.dat");
          PlayerData data = new PlayerData ();
  
          data.posX = transform.position.x;
          data.posY = transform.position.y;
          data.posZ = transform.position.z;
  
          data.rotX = transform.eulerAngles.x;
          data.rotY = transform.eulerAngles.y;
          data.rotZ = transform.eulerAngles.z;
  
          bf.Serialize (file, data);
          file.Close ();
  
      }
  
      // Update is called once per frame
      public void LoadState () {
          if(File.Exists(Application.persistentDataPath + "/PlayerData.dat")){
              BinaryFormatter bf = new BinaryFormatter();
              FileStream file = File.Open(Application.persistentDataPath + "/PlayerData.dat", FileMode.Open);
              PlayerData data = (PlayerData) bf.Deserialize(file);
              file.Close();
              transform.position = new Vector3(data.posX, data.posY, data.posZ);
              transform.rotation = Quaternion.Euler(data.rotX, data.rotY, data.rotZ);
          }
  
  
           [Serializable]
      class PlayerData{
          public float posX;
          public float posY;
          public float posZ;
  
          public float rotX;
          public float rotY;
          public float rotZ;
      }
  </code></pre>