Reputation: 3
I want to make a Unity game that sends ingame stats to a website, Like how many times a player has shot, how many kills the play has. ect.
my question is is this even possible using Unity? if yes what tools do I need?
Upvotes: 0
Views: 95
Reputation: 640
using UnityEngine.Networking;
...
IEnumerator LogEvent(kills, shots) {
WWWForm form = new WWWForm();
form.AddField("kills", kills);
form.AddField("shots", shots);
using (UnityWebRequest www = UnityWebRequest.Post("http://www.my-server.com/myform", form))
{
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError) {
Debug.Log(www.error);
} else {
Debug.Log("Form upload complete!");
}
}
}
...
public void GameOver() {
...
StartCoroutine(LogEvent(10, 100));
}
https://firebase.google.com/docs/analytics/unity/start https://developers.google.com/analytics/devguides/collection/unity/v4/devguide
In my experience, Firebase is the best one as it supports other tools like Storage, Authentication, ...
Upvotes: 1