Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by robinking · Jan 14, 2013 at 06:04 PM · iphoneplayerprefsarrayprefs

Is there a useful upper limit to the size of ArrayPrefs (PlayerPrefs) data?

I'm making a game for iOS which has a rather large set of records (high scores etc). For each of the 30 levels, there are 13 difficulty levels, and for each of those there are top tens of three different stats. All of that is for EACH player profile. So if there are 10 players, there could be up to 10 x 30 x 13 x 30 = 117,000 ints in the records. On top of that, there are other general saved preferences but the records will be the most bulk.

I figure I'll save the data at the end of each level, perhaps when losing a life and whenever the player pauses the game (as I want to save current game state too).

My question is: is this likely to result in a huge performance hiccup, using ArrayPrefs2? Using it would make coding simple. One alternative is to create a separate record file for each level for each player - but I'd rather avoid having to code my own I/O system if possible.

I'd appreciate any advice in advance of getting myself in a tangle!

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

Answer by Eric5h5 · Jan 14, 2013 at 08:13 PM

There isn't a maximum size, however PlayerPrefs just wraps NSUserDefaults, which is a plist file that's read and written as a whole, so storing that much data in it is far from efficient (and I don't know if it would cause issues trying to write it all when an app is shut down). You'd want to write separate files, preferably one per player per level. It's not really all that hard to write a system using the System.IO.File classes.

Comment
Add comment · Show 3 · 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
avatar image robinking · Jan 14, 2013 at 08:19 PM 0
Share

Very helpful as always Eric - thanks! In light of this I've decided to cut down vastly on the amount of records stored, and I've got it down to 36 ints per maze, so 1080 ints total for 30 mazes. Do you think that's still inefficient within PlayerPrefs?

avatar image Eric5h5 · Jan 14, 2013 at 08:22 PM 0
Share

That would be about 4$$anonymous$$ + some overhead, which seems reasonable.

avatar image robinking · Jan 14, 2013 at 08:35 PM 0
Share

Cool - that's good to know. I'll give it a go, and if it seems slow I'll have to make my own system. Thanks again!

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

9 People are following this question.

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

Related Questions

PlayerPrefs aren't working in iphone 2 Answers

Does ArrayPrefs2 stores data on disk ? 0 Answers

I cannot store data into PlayerPrefs after a certain amount of data 2 Answers

Guide in ArrayPrefs or PlayerPrefx? 1 Answer

arrayPrefs playerPrefs 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