So I am currently making a game that aims to help people with anxiety management. I , however, would like to ask them how they feel before playing the game and then again after playing the game. Would it be possible to do this directly on Unity? I would like for them to be able to log their entries much like an online journal. I have attached pictures from the daylio app. I would like to do something similar. At this point, I really do not know how to begin doing this on Unity. Any advice, or tutorial suggestions would be appreciated.

enter image description hereenter image description here

This far I have managed to do the following (in the picture below): This is how the survey looks (its pretty rudimentary at this point): enter image description here And this is where the information is getting displayed (in the inspector): enter image description here So now, what I would like to know, is how would I go about sending this data to somewhere else i.e. as it is in the daylio app?

  • 1
    \$\begingroup\$ "Would it be possible to do this directly in Unity?" — is there any specific step here that you feel might be IMpossible? I don't see anything more than pressing a button and logging the selection to a web service. Surely you don't believe Unity lacks buttons or web requests? Have you worked through some beginners' Unity tutorials focusing on UI setup to get some leads on how to approach this? Where specifically have you run into trouble that you need an expert to help you out of, something you can't solve with your own searching and following already-published tutorials? \$\endgroup\$ – DMGregory Oct 22 '19 at 2:53
  • \$\begingroup\$ @DMGregory Since posting this question, I have made some progress. I will edit my question accordingly. \$\endgroup\$ – user19964 Oct 22 '19 at 5:11

If these events are only for your benefit as a developer in order to measure the success of your game, then you could log the player answers as custom analytic events. Unity Analytics is a service provided by Unity Technologies. Your game can send event notifications with small amounts of data to Unity's servers. You can then log into the Unity website and get some statistics about them.

But if you would like to store historical data on the user device in order to allow the player to view their emotional history, this approach won't work. Games can post events to Unity Analytics, but they can't retrieve a history of events they posted before. The most platform-independent way of storing persistent data on the user device is using the PlayerPrefs class. But it isn't really designed to save large amounts of serial data. A better approach might be to use the standard C# classes for file input and file output (StreamWriter and StreamReader) to write and read files on the user device, but this is something which requires testing on each platform you want to support. And it won't work on platforms without a writeable filesystem, like WebGL.

If you need both - local access by the player and server-sided access for analytics - then you won't get around hosting your own server with an own database which offers an API for posting and retrieving data. Unity can post and retrieve data to/from servers using the the HTTP protocol with the class UnityWebRequest. There is a very, very wide array of possible technologies which can be used to implement such a webservice endpoint on the server side. Explaining all your options would be far out of scope for a single answer.

However, do keep in mind that you are dealing with data which is very personal. It could even be classified as (mental) health data. Data like that is often subject to legal restrictions. So inform yourself which data protection regulations apply to you if you store such data.

  • \$\begingroup\$ Firstly thank you very much for your answer : it was thorough and informative. So basically this game forms part of my research that I am doing through the university and have acquired ethical clearance to get some volunteers to test it out. Before taking part in the study, the volunteers will fill out a form stating that they are fine with this data being used anonymously. So that covers the data protection area fortunately. I basically just want a way to see if the game has had an impact on the mood of the player using this simple survey. \$\endgroup\$ – user19964 Oct 22 '19 at 18:40
  • \$\begingroup\$ Thank you once again and I will definitely consider some of the options that you have mentioned in your answer @Philipp \$\endgroup\$ – user19964 Oct 22 '19 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.