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 mahdiii · Aug 08, 2016 at 07:52 PM · unity 5arrayplayerprefssavejson

save one big json string vs multi seperate json strings in playerprefs

Suppose we want to make an RTS game. The user has several soldier cards like clash royale. The soldiers have many attributes. (attack point,health,attack ration etc in one class Soldier serialized) Is it better to save all cards of a user (one array objects converted to string json) in playerprefs or save cards one by one (not array). when we change one special soldier card (upgrade this card),if we use one array of objects(array of soldier classes), then we need to save the array completely Playerprefs.Setstring("soldierArray",json_soldierArray);

but if we use multi objects saving into playerprefs seperately we only need to save the special soldier(that was upgraded) but we need to have many string json for each of them(100 soldier cards need 100 string json) Playerprefs.Setstring("soldier1",json_soldier1); Playerprefs.Setstring("soldier2",json_soldier2); ... Playerprefs.Setstring("soldier100",json_soldier100);

which is better and known(common strategy) in performance and speed.

Comment
Add comment · Show 2
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
avatar image Dinosaurs · Aug 08, 2016 at 09:19 PM 0
Share

The wording on this question is extremely confusing, I can't tell what you're asking here. Are you trying to set the stats for individual soldiers? Or all soldiers of a specific type?

avatar image mahdiii Dinosaurs · Aug 09, 2016 at 07:34 AM 0
Share

Thank you.yes suppose you have only one class soldier and an array of soldier objects. you sometimes need to change only one element of the array and sometimes several elements of it. $$anonymous$$y question is not how to change the array. $$anonymous$$y queation is how to save them in playerprefs (individually or not one array) Suppose I need to change only one soldier stats when it is upgraded but I sometimes need to change some soldier stats. let I explain. Like clash royale game, when you upgrade one soldier so you need to change the soldier stats and save them into playerprefs (I know it has an online server it is only an example) but you sometimes need to change some soldiers stats for example when chests become open and you get several soldiers upgrade cards for example for giant,Goblins,Barbarian. I must implement playerprefs.setstring for each soldier individually or use array of them and every time update this array and send to playerprefs completely

0 Replies

· Add your reply
  • Sort: 

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

106 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

Related Questions

How to prevent to save or send a big json string? 0 Answers

Can't save serialized data (loading work) in Playerprefs for WebGL Build. 0 Answers

How do I recover my project? 0 Answers

How to read specific line with Streamreader in c#? 1 Answer

JSON to Object error Object reference not set to an instance of an object 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