3 Server Side Options to Store User Data for a Unity Game

Modern and cost-effective solutions for storing user data

Cover image
by Tommy Leung on February 21st, 2020

Let's say you have a Unity project where all user interactions must be stored on a server.

One example would be a chess game where all the moves are recorded for replay or continued play on another device.

There's no need to broadcast the data to any other users so a realtime, multiplayer server is not needed. You just need a database and way to write to it.

Some of you might be tempted to run a headless Unity on a server that then writes to a database.

You can do this but the headaches will outweigh any savings from a single codebase. You generally don't want to run Unity on or as a web server.

Here are 3 better, modern options you can use instead.

1. Platform as a Service

Using a hosted Platform as a Service (PaaS) solution is going to be the easiest.

They are products like PlayFab, GameSparks, or Firebase that are easy to implement, offers high performance, and scales easily.

All the mentioned services have a Unity SDK you can use for quick and mostly painless integration.

PlayFab and GameSparks are geared towards games but they may have way more services than you need for simply storing user data.

Firebase has several services as well but they are best known for their NoSQL database product.

All three are a great choice and provides a free/development tier. If you can't decide which then just pick based on whether you like Microsoft, Amazon, or Google better. The tech giants own one of each respectively. 😎

2. Serverless

This will be more complicated than a PaaS solution but still saves you from having to manage servers and can automatically scale to any load.

Your best bet is to use a serverless function and a serverless database combination to expose endpoints to call using UnityWebRequest.

They are products like:

One downside to this option compared to PaaS is that you'll have to implement some way to secure your functions and/or your database.

Azure, AWS, and Google Cloud all have identity authentication services or you can use something like Auth0 or Okta.

Azure Functions and AWS Lambda both support C# which is a plus for having a consistent language across client and server.

One variation of note is to use a serverless function with a traditional SQL database but this will likely cost more.

3. REST Server

Deploying a REST server is the most complicated of the 3 options but you can use services like Heroku or NodeChef to make it simpler. You can also deploy to Azure, AWS, or GCP.

Heroku does not officially support C# but there are community buildpacks with .NET support.

With this option, you'll have to implement a REST server that talks to a database, secure it, and handle scaling.

If you've worked on REST backends in the past than this might actually be simpler than the serverless option. Serverless is a different paradigm that can take some time to get used to.

One drawback with this option compared to serverless is the cost if you are expecting a lot of idle time.

Heroku does allow you to deploy for free since they will put your node to sleep after inactivity but most other services require you to pay for each hour the server is running.


If you don't care about backends or servers then go with a PaaS solution. They are easy to integrate, scale automatically, and you can get started for free.

How can you beat that?

Let me know in the comments below if you'd like an in-depth guide with code examples for any of the above options. Be sure to include the platform! 👌

Don't miss out on future Unity techniques! Enter your email into the box below to subscribe.