PD4 project

arrow down

What I learned:

  • MySQL
  • Playfab
  • Entity Framework
  • Web requests
  • IIS

Tools I used

  • Unity
  • IIS
  • SQL server management studio 20
  • Postman

About the project:

Discord community

TLDR: This project thought me how to setup a webserver with a database locally and connect it with a Unity project and Playfab.

This project thought me how to setup a webserver with a database locally. I learned how to connect a Unity project with a webserver and database using web requests. I used IIS to setup a local webserver and SQL server management studio to setup a local database. Using the entity framework I created a web API to connect the database with the webserver.

I also learned how to use Postman to test the web API. Finally I learned how to connect Playfab with my unity project and store data interchangeably. This project was made as a school project for the course Platform Development 4.


How did I do it?

First I set up a local database using SQL server management studio. Then I created a web API using the entity framework to connect the database with a webserver. From that point on I followed a code-first approach to create the database tables starting from the code.

In Unity I created a simple game where you could generate a maze. Using web requests I connected the Unity project with the web API to store and retrieve data from the database. The main part of this database was storing the generated mazes and their tiles.

Finally I connected Playfab with my Unity project to store and retrieve data from Playfab as well. This way I could store data both locally and on Playfab.

Combined playfab and mysql logos

What problems did I face?

The biggest problem I faced was figuring out all the settings I had to toggle on/off in IIS to get the web API working. After days of researching and asking for help I finally got it working.

At that point my database was not up to date with the code anymore. I tried migrations but those would not work because I began with a database-first approach. After a lot of trial and error, I decided to just delete the whole database and let the code create a new one. This choice is not the ideal solution in a real working environment, but since the database only contained test data it was not a big problem.

Luckily I did not face any problems connecting Playfab with my Unity project, because this had very clear documentation.