How to: Connect your Unity game to Database, MongoDB Atlas, leader board, multiplayer cross platform

How to: Connect your Unity game to Database, MongoDB Atlas, leader board, multiplayer cross platform



In this tutorial I show you how to connect unity to MongoDB atlas to create a leader board and with this setup you can create multiplayer game, cross platform and much much more!

PS: This should not be used like this in production, the database password is exposed in the code. I will create a second part to this video where I show you how to safely create a API for this set up.
This is however a great way to get started, you can add the security before production

I’m doing this with the Oculus quest but you can use this in any unity project on any platform it does not matter!

Contact: [email protected]

19 thoughts on “How to: Connect your Unity game to Database, MongoDB Atlas, leader board, multiplayer cross platform

  1. Hello sorry for disturbing again but i want to save a vector3 position instead of a float how can i do that?

  2. hi, may i know how i can add a new field to an existing document with the document id ? (by coding in unity c#)

  3. Hi. I followed your tut, and worked great. I played around with it for a while, and wouldnt it be better to extract the value from an element from the db instead of doing a string manipulation?

    I pasted my code below:

    var filter = Builders<BsonDocument>.Filter.Eq("Roomname","Test");

    var result = collection.Find(filter).ToList();

    string Roomname = result[0].GetElement("Roomname").Value.ToString();

  4. Hi thanks, great tutorial
    instead of manual deserialization, you could use BsonSerializer.Deserialize

  5. I am unable to debug the program. Keep getting error "A project with Output Type of Class library can not be started directly." I tried setting the start up project but no use. Can you help?

  6. Hey, really loved your tutorial, is there any way I can get those ddls for free? I'm a student so don't really have an income.

Leave a Reply

Your email address will not be published. Required fields are marked *