a
aunknown
csharp
2 years ago
822 B
4
Indexable
Never
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking; public class webRequests : MonoBehaviour { public void SaveData(string username, int score, int time) { Debug.Log("Send"); StartCoroutine(WaitForResponse(username, score, time)); } IEnumerator WaitForResponse(string username, int score, int time) { UnityWebRequest www = UnityWebRequest.Post("http://api.tralalandia.com/saver.php?username=" + username + "&score=" + score + "&timer=" + time + "&gamename=ProjectExdo", ""); yield return www.SendWebRequest(); if (www.result != UnityWebRequest.Result.Success) { Debug.Log(www.error); } else { Debug.Log(www.downloadHandler.text); } } }