Writing to a database from Unity - through a microservice

I’m making a unity application which uses an eye tracker, I want to save all the eye coordinates to a database. I have a postgreSQL database to work with. I don’t want to make the unity app communicate directly to the database, I would want some sort of micro service in between these two things. Here I am kind of stuck, what kind of micro service should I use/write to get my data from my client over to the database. Or do you have any other recommendations about how I should approach this.

I tried writing a c# class and copied the dll’s over as a managed plugin to unity, but here I always have a issue with the incompatible .net.
I have to have a recent .net framework in my service so I can use npgsql, which I need so .net can access postgreSQL but monodevelop doesn’t support a recent .net framework.

So to sum up, does anyone have suggestions as to how I could solve this problem.

I’ve used sails.js with Unity before for SQL databases. It’s really easy to generate a REST api for it too.

When using sails.js with unity, did you use sails.js just for the backend?
How did you establish the communication between the sails.js app and unity, did you do this with post requests?

Sails will also allow you to create a front-end too ie. Web app. But even without that you can still use the API you generate.

You are right, I used Unity’s WWW class to make my requests to the server.

1 Like