You may or may not be aware, but we have a Realm SDK for Unity in the works! To give everyone a taste, I’ve cooked up a tutorial that makes use of it:
The tutorial is for building an infinite runner type game. Think Temple Run or Subway Surfer where you kind of run forever dodging obstacles and collecting rewards.
The SDK is currently alpha so expect that there could be bugs. As the SDK progresses and improves, I’ll be sharing more content on how to build amazing games that persist to Realm and MongoDB!
Please don’t hesitate to reach out if you have any questions.
Are you referring to the constructor method and the overloaded constructor method? Since it is a class, we need to be able to set the variables. We use the overloaded version throughout the project, but Realm has a requirement that we have a basic constructor as well.
Thanks for your reply!
I guess I haven’t seen this syntax before, especially since I’m new to C#, coming from the Python side of things.
So you class definition is PlayerStats, then your basic constructor is “public PlayerStats() { }” and the overloaded version is “public PlayerStats(string username, int score)”?
Do you have a link by any chance where I can read up about this in detail?
I’m definitely curious as to why you need to declare this constructor twice or is that just some quirk that I need to accept and not wonder too much about it?
This link might help for method and constructor overloading:
If you can accomplish what you want using the default constructor, then you don’t need to create others. However, you can create as many variations as you want, as long as you have the default, even if you don’t plan to use the default.