• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Eco-Editor · Mar 05 at 05:57 PM · loaddatabasejsondatadynamically

Dynamically load json data to a game: What are the best practices?

Hi Everybody,

I'm working on an a quiz type game which currently includes lots of data from excel files, which I manually transfer to json file, and load to the game.

I found several code packages for excel to json (didn't try them yet):

https://unitylist.com/p/28t/Unity-excel-importer

https://github.com/pedicagames/Excel-To-JSon-C-Unity-

https://forum.unity.com/threads/released-unity-quicksheet.289146/

However, I'd like to implement remote data storage and local data storage, so data can be updated dynamically to the game based on player progress.

Are you familiar with best practice to loading data into database, where this will be dynamically pushed to a game?

Which database / service can suit my needs?

Thanks

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by sacredgeometry · Mar 06 at 12:50 PM

Use Newtonsoft.Json it is the industry standard for C#/.NET JSON deserialisation/ serialisation.


Just read the file as a string using any of the normal .NET methods and use the Newtonsoft deserialisation method to map it onto an equivalent c# models i.e. POCOs.

https://www.newtonsoft.com/json/help/html/deserializeobject.htm


I suggest doing it by hand but if you are feeling lazy there are plenty of tools for generating the C# types which might get you most of the way there if there is a lot of data/ type variation. https://quicktype.io/csharp


Regarding the "remote storage", thats what databases are for, front a database with an api that provides an interface for the basic CRUD for the data you are trying to store. If SQL: You could use an ORM like Entity Frameworks or PetaPOCO to make talking to the database a little easier

https://docs.microsoft.com/en-us/ef/


Any SQL variant will do, I favour Postgres personally if I have a choice, otherwise MSSQL or MySQL will do the job fine.

https://www.postgresql.org/ https://www.microsoft.com/en-gb/sql-server/sql-server-2019 https://www.mysql.com/


Other than that you have NoSQL options like Mongo that may be useful. It really depends on your requirements. No real need for an ORM here they are pretty simple to set up CRUD the complexities really start to emerge when you are trying to work with a lot of data and how best to structure it as its a little more open ended than SQL.


The api can be written in what ever language and framework you want but C# .net/ web apis are pretty good and it would save you a lot of effort as you could share the DTOs in a single library across your two projects meaning less maintenance burden.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

142 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to save and load any data type? 1 Answer

Best tool to load data 1 Answer

Calling Json script and displaying the Images within the script 0 Answers

[Quiz game] How do I make players contribute with questions? 1 Answer

Saving and Loading and assinging to gameobject 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges