i am developing an application and it contains quiz game, score, and retrieval of user name. my question is do i have to use database or i can achieve this by scripting? if have to use database which one do you recommend?
Thank you in advance<3
i am developing an application and it contains quiz game, score, and retrieval of user name. my question is do i have to use database or i can achieve this by scripting? if have to use database which one do you recommend?
Thank you in advance<3
I don’t understand the “or” part of your question. You can’t create a game without scripting.
As far as whether you need a database, you haven’t mentioned anything that couldn’t be an entirely local game. Usernames could mean online multiplayer, but could also mean multiple local users. If it is online, then you’ll likely want a database. If local only, usernames and score are pretty trivial, so can probably be handled just with PlayerPrefs.
As far as which database, there are several database as a service providers you should investigate. The general go to solution when you want to roll your own is setting up a MySQL server and interfacing with UnityWebRequest. But when you roll your own, you’re not only programming it all, you’re also in charge of all IT / security issues.
its a local app.
how can i store with playerprefs?
if it’s local then is pretty easy.
You can implement it like this:
if you are using floats (for example scores)
PlayerPrefs.SetFloat(“Score”, 50.0F);
int (example: level)
PlayerPrefs.SetInt(“Level”, 20);
and string (example: player names)
PlayerPrefs.SetString(“Name”, “fa4da”);
and to retrieve that data, you can do it like this:
string userName = PlayerPrefs.GetString("Name");
float playerScore = PlayerPrefs.GetFloat("Score");
int playerLevel = PlayerPrefs.GetInt("Level");
you can learn more about them here:
That’s just the basic…
If you really want to save a ton of data (still locally) you can use XML, TXT, CSV files…
you can find some assets on the AssetStore that Read/Write those files.
But I think the above would solve save your needs!