Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
  • Help Room /
avatar image
0
Question by Aaranos · Jul 18, 2016 at 05:03 PM · playerprefsdatabasedata storage

Best practice for storing template data plus character data?

I have a mobile project I am working on that involves a lot of data and I am stuck pretty much at the start because I want to iron out the way the different pieces interact before trying to force a square peg down a circle hole.

The type of data I am working with is as follows:

  • Player

Player owns characters, a rpg party essentially. These characters are based on templates that hold name, base stats, and various types of data. The player will also have data related to what they have done, ie quests completed etc.

  • Character

Each character will be pulled from their template which says when they unlock certain things and how their stats will progress. Essentially storing a list of characters as they are by default.

Pretty standard information for a game. I've mostly only made quick games that were one scene and more arcade style so I'm in new territory for the most part.

Ways I've considered storing this data:

  1. Storing them in an empty game object (Database) in a list for each category. Each character, monster, etc would be a gameobject setup as they would be at default. Once the player owns something it would become an object childed to them, a copy that is. This feels like a crude way of storing data.

  2. Storing the data in a script for each. (Ex. Monster1.cs, Monster2.cs) and mapping it onto a template "character" This seems like the best way? Feels like it would be a lot of script clutter though.

  3. Storing data in a type of text database and pulling it from templates and writing to the playerprefs.

Am I on the right track here?

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
Best Answer

Answer by Aaranos · Jul 24, 2016 at 10:30 PM

In case anyone finds this later or cares to know the answer I came to. I found a Unity video from the main site that covered data persistence. I will be attempting serialization in order to save and load my data, the fun part now is making a system that fits everything I need.

Player prefs is too easily accessible to store data that players could easily change. They also are very limiting in the type of data that you can store.

An external database does not have any official support that I can tell from Unity but it is a possible solution, so long as you know what works best in your coding language.

Overall, serialization lets you store gameObjects and by using a save/load mechanic the data can be retained between sessions. Additionally, by using DontDestroyOnLoad the object can persist across scenes so that you don't have to reload the character and other data between them.

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

64 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

Related Questions

leaderboard data - xml, database or PlayerPrefs 0 Answers

random question without repetition 0 Answers

How to save data to load outside of unity 1 Answer

Offline presence of data stored in firebase 0 Answers

How to increment data stored while player is offline? 1 Answer


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