Report this

What is the reason for this report?

How to connect Unity to Postgresql database?

Posted on January 8, 2022

I am trying to connect my Unity game to a database I have, however, I’m not sure how I can send a request to it. It’s code that will only be on the server, so I want to write C# code to retrieve data from the database.

I’m also confused as to how I would create new tables. Do I have to use the console the database is assigned to and somehow send SQL commands to create tables that way? I’m not sure because I’m new to this, so any help would be appreciated!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @galactichyperstar,

I’ll recommend you to check the following:

Getting Started with DigitalOcean Managed Databases for PostgreSQL Youtube Video

Just how managed are DigitalOcean’s Managed Databases and how to use them :

https://www.digitalocean.com/blog/just-how-managed-are-digitaloceans-managed-databases/

and the most important one the documentation:

https://docs.digitalocean.com/products/databases/

Basically, you’ll be able to connect to your database and execute commands like CREATE/UPDATE/DROP etc.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.