{"id":955,"date":"2023-05-07T23:28:00","date_gmt":"2023-05-07T21:28:00","guid":{"rendered":"https:\/\/www.bellingo.de\/blog\/?p=955"},"modified":"2023-05-12T17:43:57","modified_gmt":"2023-05-12T15:43:57","slug":"realm-database-for-unity-games-devblog-31","status":"publish","type":"post","link":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/","title":{"rendered":"Realm Database for Unity Games (DevBlog #31)"},"content":{"rendered":"\n<p><a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.GamesVineyard.NetworkTraders\" target=\"_blank\" rel=\"noreferrer noopener\">Network Traders<\/a>, the game I am currently working on, stores parts of the game data in a central, cloud-hosted database. But some of the user-specific data is private in nature and therefore only stored on the player&#8217;s mobile device. Until now, I have just serialized this data to persistent storage. But as I needed to add new user-specific properties, I wondered why I should not use a database on the client as well. After all, they may provide benefits such as <a href=\"https:\/\/en.wikipedia.org\/wiki\/ACID\" target=\"_blank\" rel=\"noreferrer noopener\">atomicity<\/a> or <a href=\"https:\/\/en.wikipedia.org\/wiki\/Schema_migration\" target=\"_blank\" rel=\"noreferrer noopener\">migrations<\/a> when the database schema changes. After some searching I found <a href=\"https:\/\/realm.io\/\" target=\"_blank\" rel=\"noreferrer noopener\">Realm<\/a>, which integrated nicely into my Unity project, although with some intricacies I would have liked to know beforehand.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">Why use a Database?<\/h2>\n\n\n\n<p>Working on a game with a client app and a backend server, I have a direct comparison between using a database (server backend) and serialized data (client). The server is written in .NET C# and connected to a <a href=\"https:\/\/mariadb.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">MariaDB<\/a> database. I use <a href=\"https:\/\/learn.microsoft.com\/en-us\/ef\/core\/\" target=\"_blank\" rel=\"noreferrer noopener\">Entity Framework Core<\/a> to easily access my data with <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/csharp\/programming-guide\/concepts\/linq\/\" target=\"_blank\" rel=\"noreferrer noopener\">LINQ<\/a> statements, so no hassle with SQL queries. When I need to add or remove tables or columns or move them around, I can do so easily with <a href=\"https:\/\/fluentmigrator.github.io\/\" target=\"_blank\" rel=\"noreferrer noopener\">Fluent Migrator<\/a> migrations.<\/p>\n\n\n\n<p>On the client side, I did what people usually do, I serialized my data into files using the <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.runtime.serialization.formatters.binary.binaryformatter?view=net-7.0\" target=\"_blank\" rel=\"noreferrer noopener\">BinaryFormatter<\/a>. That is fine as long as your data stays the same over a long time or you only add new classes to be serialized. But, like in the backend, once you start moving data around between versions of your game, you need to start storing version information and convert the data for every new client version. Worse still, you never know what client version the players have out there, so all conversion routines have to stay in your code indefinitely. In other words, you need to implement migrations yourself. That was when I seriously started thinking about using a database for the client app as well.<\/p>\n\n\n\n<div class='code-block code-block-2' style='margin: 8px 0; clear: both;'>\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-5801154588989661\"\n     crossorigin=\"anonymous\"><\/script>\n<!-- Posts Standard -->\n<ins class=\"adsbygoogle\"\n     style=\"display:block\"\n     data-ad-client=\"ca-pub-5801154588989661\"\n     data-ad-slot=\"5874520813\"\n     data-ad-format=\"auto\"\n     data-full-width-responsive=\"true\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/div>\n\n\n\n\n<h2 class=\"wp-block-heading\">Alternatives<\/h2>\n\n\n\n<p>As it was all about convenience, I started looking for a single-user database providing a fluent interface and migrations. And, of course, it had to integrate well into a Unity project. The first one I came across, and which was also recommended by the folks at <a href=\"https:\/\/www.reddit.com\/r\/unity\/comments\/11kg07l\/use_of_a_database_for_persistent_ingame_data\/\" target=\"_blank\" rel=\"noreferrer noopener\">Reddit<\/a> and <a href=\"https:\/\/mastodon.gamedev.place\/@GamesVineyard\/109978360297262559\" target=\"_blank\" rel=\"noreferrer noopener\">Mastodon<\/a>, was SQLite. There is a very good description by Rizwan Asif on <a href=\"https:\/\/medium.com\/@rizasif92\/sqlite-and-unity-how-to-do-it-right-31991712190\" target=\"_blank\" rel=\"noreferrer noopener\">how to bring SQLite and Unity together<\/a>. However, I did not really find a convincing solution on how to add a fluent interface and migrations. At this point, I would also like to mention <a href=\"https:\/\/developer.android.com\/training\/data-storage\/room\" target=\"_blank\" rel=\"noreferrer noopener\">Room<\/a>, the built-in Android database. But there currently seems to be no API for Unity. So in the end, I gave Realm a try.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is Realm?<\/h2>\n\n\n\n<p>As <a href=\"https:\/\/en.wikipedia.org\/wiki\/Realm_(database)\" target=\"_blank\" rel=\"noreferrer noopener\">Wikipedia<\/a> puts it, Realm &#8222;is an open source object database management system&#8220;. The <a href=\"https:\/\/github.com\/realm\" target=\"_blank\" rel=\"noreferrer noopener\">Realm<\/a> devs advertise it as a mobile database and a replacementfor <a href=\"https:\/\/en.wikipedia.org\/wiki\/SQLite\" target=\"_blank\" rel=\"noreferrer noopener\">SQLite<\/a> and <a href=\"https:\/\/en.wikipedia.org\/wiki\/Object%E2%80%93relational_mapping\" target=\"_blank\" rel=\"noreferrer noopener\">ORMs<\/a>. While Realm is available under the Apache License 2.0, it is owned by <a href=\"https:\/\/www.mongodb.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">MongoDB Inc<\/a>. It is not, however, based on MongoDB.<\/p>\n\n\n\n<p>Realm is actually a quite comprehensive bundle offering not only local databases, but also synchronization with a backend service called &#8222;Atlas&#8220;. In my case, however, it was the convenience it provides for storing data locally on a device that made me give it a try. It covers all the requirements I listed above: seamless integration into C# code, migrations, and on top of it a <a href=\"https:\/\/www.mongodb.com\/developer\/products\/realm\/realm-how-to-add-realm-to-your-unity-project\/#add-realm\" target=\"_blank\" rel=\"noreferrer noopener\">Unity package<\/a> is provided.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Integration into your Unity Project<\/h2>\n\n\n\n<p>Integration of Realm into your Unity project is straight-forward. The <a href=\"https:\/\/www.mongodb.com\/docs\/realm\/sdk\/dotnet\/unity\/\" target=\"_blank\" rel=\"noreferrer noopener\">installation instructions<\/a> using the NPM registry are easy to follow, and you are quickly ready for your first steps. The <a href=\"https:\/\/www.mongodb.com\/developer\/search\/?s=unity&amp;sortMode=0\" target=\"_blank\" rel=\"noreferrer noopener\">MongoDB blogs page<\/a> lists quite a few tutorials and examples to get you started with your first <code>Realm.GetInstance()<\/code>.<\/p>\n\n\n\n<p>In order to store data in your new Realm instance, you need to define an <a href=\"https:\/\/www.mongodb.com\/docs\/realm\/sdk\/dotnet\/model-data\/define-object-model\/\" target=\"_blank\" rel=\"noreferrer noopener\">object schema<\/a> for it. This is a class derived from <code>IRealmObject<\/code>. In my case, for example, I store information about cities in the Realm database, where the schema definition looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public partial class CityEntity : IRealmObject\n{\n  &#091;PrimaryKey]\n  public string PlayerId { get; set; }\n  public string CityName { get; set; }\n  public int GoodID { get; set; }\n  public string Notes { get; set; }\n}<\/code><\/pre>\n\n\n\n<p>Each player builds their own city on their mobile device, and sends <a href=\"https:\/\/www.bellingo.de\/blog\/devblog-the-merchants-in-network-traders\/\" target=\"_blank\" rel=\"noreferrer noopener\">merchants<\/a> to other players to trade the goods they produce. Read more about this in my article about <a href=\"https:\/\/www.bellingo.de\/blog\/devblog-the-idea-behind-network-traders\/\" target=\"_blank\" rel=\"noreferrer noopener\">the idea behind network traders<\/a>.<\/p>\n\n\n\n<p>Once your data model is defined, you can <a href=\"https:\/\/www.mongodb.com\/docs\/realm\/sdk\/dotnet\/crud\/create\/\" target=\"_blank\" rel=\"noreferrer noopener\">write these objects to the database<\/a> using a transaction inside <code>realm.Write(() =&gt; {..})<\/code>. Specific objects are retrieved either using the <code><a href=\"https:\/\/www.mongodb.com\/docs\/realm\/sdk\/dotnet\/crud\/read\/\" target=\"_blank\" rel=\"noreferrer noopener\">Find<\/a><\/code> method, or through <a href=\"https:\/\/www.mongodb.com\/docs\/realm\/sdk\/dotnet\/crud\/filter\/\" target=\"_blank\" rel=\"noreferrer noopener\">queries in LINQ syntax<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Hurdles<\/h2>\n\n\n\n<p>Using Realm is not difficult, especially if you have worked with other database integrations before. But as with every new piece of software, there are some hurdles you might stumble over, as did I. So here is a short list for troubleshooting what may be common beginner&#8217;s mistakes.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><em>Proceed step by step<\/em>. If you intend to introduce Realm into an existing project, consider doing it in small steps. Realm may force you to make changes to your data model. The more different objects you need to store, the more you need to change. I first tried to rework all of my data storage, but realized that this incurs a high risk of errors. In this case, those may be critical as player data may be lost. So I started with a partial rework, with the rest of the data types following one after the other.<\/li>\n\n\n\n<li><em>String comparisons. <\/em>Realm reacts strangely regarding string comparisons and method calls in where clauses. The call<br><code>realm.All&lt;Entity&gt;().Where(x =&gt; x.idString.Equals(guid.ToString()))<\/code><br>throws two different kinds of errors. Avoid <code>Equals<\/code> and <code>toString<\/code> and use the following code instead:<br><code>realm.All&lt;Entity&gt;().Where(x =&gt; x.idString == guidString)<\/code><br>where <code>guidString<\/code> is the GUID converted to string. The manual page on <a href=\"https:\/\/www.mongodb.com\/docs\/realm\/sdk\/dotnet\/crud\/filter\/\" target=\"_blank\" rel=\"noreferrer noopener\">filtering and sorting<\/a> explains much of this, but there is plenty of room for mistakes.<\/li>\n\n\n\n<li><em>Persistent storage on Android.<\/em> This actually cost me quite some headaches. I had a functioning version running in the Unity editor, and then deployed it on an Android device. As database location, I had selected <code>Application.persistentDataPath<\/code> which I had been using before, too. But now I got an exception saying that this was a &#8222;read-only file system&#8220;. After asking for &#8211; and getting &#8211; advice on the <a href=\"https:\/\/www.mongodb.com\/community\/forums\/t\/writing-to-android-persistent-storage-with-unity-throws-read-only-file-system-error\/224093\" target=\"_blank\" rel=\"noreferrer noopener\">Realm forum<\/a> it turned out that <code>persistentDataPath<\/code> historically points to &#8222;external&#8220; storage, which used to be sdcards. Realm specifically uses the internal data path as default. Read <a href=\"https:\/\/www.mongodb.com\/community\/forums\/t\/writing-to-android-persistent-storage-with-unity-throws-read-only-file-system-error\/224093\" target=\"_blank\" rel=\"noreferrer noopener\">the forum thread<\/a> for more information.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>Realm seems to be what I have been looking for when it comes to conveniently storing game data on a mobile device. However, I still feel like an early adopter sometimes, although Realm has been around for roundabout ten years. Anyway, I spent quite some time adjusting my data models, so I will stick to it for the time being. Next time I start a new project, and if nothing severe happens, I will probably go for Realm from the start. That will hopefully prevent some of the hassles I have gone through with Network Traders.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Network Traders, the game I am currently working on, stores parts of the game data in a central, cloud-hosted database. But some of the user-specific data is private in nature and therefore only stored on the player&#8217;s mobile device. Until now, I have just serialized this data to persistent storage. But as I needed to &hellip; <a href=\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/\" class=\"more-link\"><span class=\"screen-reader-text\">Realm Database for Unity Games (DevBlog #31)<\/span> weiterlesen<\/a><\/p>\n","protected":false},"author":1,"featured_media":967,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[229,49,55],"tags":[353,230,285,231,357,355,67],"class_list":["post-955","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devblog","category-game-development","category-unity-en","tag-database","tag-devblog","tag-mobile","tag-network-traders","tag-persistent-storage","tag-realm","tag-unity-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Realm Database for Unity Games (DevBlog #31) - Games:Tech:Blog<\/title>\n<meta name=\"description\" content=\"I am using the Realm in Unity to persistently store game data on a mobile device, with all the benefits of a database. A short introduction.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Realm Database for Unity Games (DevBlog #31) - Games:Tech:Blog\" \/>\n<meta property=\"og:description\" content=\"I am using the Realm in Unity to persistently store game data on a mobile device, with all the benefits of a database. A short introduction.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/\" \/>\n<meta property=\"og:site_name\" content=\"Games:Tech:Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-07T21:28:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-12T15:43:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.bellingo.de\/blog\/wp-content\/uploads\/2023\/05\/Beitragsbild-Realm.png\" \/>\n\t<meta property=\"og:image:width\" content=\"829\" \/>\n\t<meta property=\"og:image:height\" content=\"464\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ingo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ingo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"7\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/\"},\"author\":{\"name\":\"Ingo\",\"@id\":\"https:\/\/www.bellingo.de\/blog\/#\/schema\/person\/82498f8ac21d11f5948cab6d0a9807e9\"},\"headline\":\"Realm Database for Unity Games (DevBlog #31)\",\"datePublished\":\"2023-05-07T21:28:00+00:00\",\"dateModified\":\"2023-05-12T15:43:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/\"},\"wordCount\":1135,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.bellingo.de\/blog\/#\/schema\/person\/82498f8ac21d11f5948cab6d0a9807e9\"},\"image\":{\"@id\":\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.bellingo.de\/blog\/wp-content\/uploads\/2023\/05\/Beitragsbild-Realm.png\",\"keywords\":[\"Database\",\"DevBlog\",\"Mobile\",\"Network Traders\",\"Persistent Storage\",\"Realm\",\"Unity\"],\"articleSection\":[\"DevBlog\",\"Game development\",\"Unity\"],\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/\",\"url\":\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/\",\"name\":\"Realm Database for Unity Games (DevBlog #31) - Games:Tech:Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.bellingo.de\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.bellingo.de\/blog\/wp-content\/uploads\/2023\/05\/Beitragsbild-Realm.png\",\"datePublished\":\"2023-05-07T21:28:00+00:00\",\"dateModified\":\"2023-05-12T15:43:57+00:00\",\"description\":\"I am using the Realm in Unity to persistently store game data on a mobile device, with all the benefits of a database. A short introduction.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#primaryimage\",\"url\":\"https:\/\/www.bellingo.de\/blog\/wp-content\/uploads\/2023\/05\/Beitragsbild-Realm.png\",\"contentUrl\":\"https:\/\/www.bellingo.de\/blog\/wp-content\/uploads\/2023\/05\/Beitragsbild-Realm.png\",\"width\":829,\"height\":464,\"caption\":\"Network Traders and Realm: how to use the database in your Unity app\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.bellingo.de\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Realm Database for Unity Games (DevBlog #31)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.bellingo.de\/blog\/#website\",\"url\":\"https:\/\/www.bellingo.de\/blog\/\",\"name\":\"Games:Tech:Blog\",\"description\":\"A Blog about Games, Technology in Games, and Technology in General\",\"publisher\":{\"@id\":\"https:\/\/www.bellingo.de\/blog\/#\/schema\/person\/82498f8ac21d11f5948cab6d0a9807e9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.bellingo.de\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.bellingo.de\/blog\/#\/schema\/person\/82498f8ac21d11f5948cab6d0a9807e9\",\"name\":\"Ingo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/www.bellingo.de\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/93a4b9881ee1983f4fafc7e996ce82a42c3a1540c18f7417809c08a19658f167?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/93a4b9881ee1983f4fafc7e996ce82a42c3a1540c18f7417809c08a19658f167?s=96&d=mm&r=g\",\"caption\":\"Ingo\"},\"logo\":{\"@id\":\"https:\/\/www.bellingo.de\/blog\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.bellingo.de\/blog\/author\/ingo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Realm Database for Unity Games (DevBlog #31) - Games:Tech:Blog","description":"I am using the Realm in Unity to persistently store game data on a mobile device, with all the benefits of a database. A short introduction.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/","og_locale":"de_DE","og_type":"article","og_title":"Realm Database for Unity Games (DevBlog #31) - Games:Tech:Blog","og_description":"I am using the Realm in Unity to persistently store game data on a mobile device, with all the benefits of a database. A short introduction.","og_url":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/","og_site_name":"Games:Tech:Blog","article_published_time":"2023-05-07T21:28:00+00:00","article_modified_time":"2023-05-12T15:43:57+00:00","og_image":[{"width":829,"height":464,"url":"https:\/\/www.bellingo.de\/blog\/wp-content\/uploads\/2023\/05\/Beitragsbild-Realm.png","type":"image\/png"}],"author":"Ingo","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Ingo","Gesch\u00e4tzte Lesezeit":"7\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#article","isPartOf":{"@id":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/"},"author":{"name":"Ingo","@id":"https:\/\/www.bellingo.de\/blog\/#\/schema\/person\/82498f8ac21d11f5948cab6d0a9807e9"},"headline":"Realm Database for Unity Games (DevBlog #31)","datePublished":"2023-05-07T21:28:00+00:00","dateModified":"2023-05-12T15:43:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/"},"wordCount":1135,"commentCount":0,"publisher":{"@id":"https:\/\/www.bellingo.de\/blog\/#\/schema\/person\/82498f8ac21d11f5948cab6d0a9807e9"},"image":{"@id":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#primaryimage"},"thumbnailUrl":"https:\/\/www.bellingo.de\/blog\/wp-content\/uploads\/2023\/05\/Beitragsbild-Realm.png","keywords":["Database","DevBlog","Mobile","Network Traders","Persistent Storage","Realm","Unity"],"articleSection":["DevBlog","Game development","Unity"],"inLanguage":"de","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/","url":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/","name":"Realm Database for Unity Games (DevBlog #31) - Games:Tech:Blog","isPartOf":{"@id":"https:\/\/www.bellingo.de\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#primaryimage"},"image":{"@id":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#primaryimage"},"thumbnailUrl":"https:\/\/www.bellingo.de\/blog\/wp-content\/uploads\/2023\/05\/Beitragsbild-Realm.png","datePublished":"2023-05-07T21:28:00+00:00","dateModified":"2023-05-12T15:43:57+00:00","description":"I am using the Realm in Unity to persistently store game data on a mobile device, with all the benefits of a database. A short introduction.","breadcrumb":{"@id":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#primaryimage","url":"https:\/\/www.bellingo.de\/blog\/wp-content\/uploads\/2023\/05\/Beitragsbild-Realm.png","contentUrl":"https:\/\/www.bellingo.de\/blog\/wp-content\/uploads\/2023\/05\/Beitragsbild-Realm.png","width":829,"height":464,"caption":"Network Traders and Realm: how to use the database in your Unity app"},{"@type":"BreadcrumbList","@id":"https:\/\/www.bellingo.de\/blog\/realm-database-for-unity-games-devblog-31\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.bellingo.de\/blog\/"},{"@type":"ListItem","position":2,"name":"Realm Database for Unity Games (DevBlog #31)"}]},{"@type":"WebSite","@id":"https:\/\/www.bellingo.de\/blog\/#website","url":"https:\/\/www.bellingo.de\/blog\/","name":"Games:Tech:Blog","description":"A Blog about Games, Technology in Games, and Technology in General","publisher":{"@id":"https:\/\/www.bellingo.de\/blog\/#\/schema\/person\/82498f8ac21d11f5948cab6d0a9807e9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bellingo.de\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":["Person","Organization"],"@id":"https:\/\/www.bellingo.de\/blog\/#\/schema\/person\/82498f8ac21d11f5948cab6d0a9807e9","name":"Ingo","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.bellingo.de\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/93a4b9881ee1983f4fafc7e996ce82a42c3a1540c18f7417809c08a19658f167?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/93a4b9881ee1983f4fafc7e996ce82a42c3a1540c18f7417809c08a19658f167?s=96&d=mm&r=g","caption":"Ingo"},"logo":{"@id":"https:\/\/www.bellingo.de\/blog\/#\/schema\/person\/image\/"},"url":"https:\/\/www.bellingo.de\/blog\/author\/ingo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bellingo.de\/blog\/wp-json\/wp\/v2\/posts\/955","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bellingo.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bellingo.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bellingo.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bellingo.de\/blog\/wp-json\/wp\/v2\/comments?post=955"}],"version-history":[{"count":11,"href":"https:\/\/www.bellingo.de\/blog\/wp-json\/wp\/v2\/posts\/955\/revisions"}],"predecessor-version":[{"id":976,"href":"https:\/\/www.bellingo.de\/blog\/wp-json\/wp\/v2\/posts\/955\/revisions\/976"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bellingo.de\/blog\/wp-json\/wp\/v2\/media\/967"}],"wp:attachment":[{"href":"https:\/\/www.bellingo.de\/blog\/wp-json\/wp\/v2\/media?parent=955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bellingo.de\/blog\/wp-json\/wp\/v2\/categories?post=955"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bellingo.de\/blog\/wp-json\/wp\/v2\/tags?post=955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}