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
16
Question by karl_ · Jul 15, 2010 at 03:13 AM · arrayplayerprefs

Store Array in PlayerPrefs?

Is this possible? I've not been able to figure out how to get this to work.

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

4 Replies

· Add your reply
  • Sort: 
avatar image
24
Best Answer

Answer by Umai · Dec 25, 2014 at 07:54 AM

As noted, use this now. The accepted answer site is dead at this time.

http://wiki.unity3d.com/index.php/ArrayPrefs2

Comment
Add comment · Show 1 · 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 WyattJ1834 · Dec 15, 2018 at 06:01 PM 0
Share

This would work, but unity no longer supports Javascript, any fixes?

avatar image
36

Answer by Eric5h5 · Jul 15, 2010 at 04:12 AM

http://www.unifycommunity.com/wiki/index.php?title=ArrayPrefs

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 karl_ · Jul 15, 2010 at 04:19 AM 0
Share

I wish I could up-vote this answer more than once. Thanks a bunch!

avatar image chelnok · Sep 26, 2012 at 07:31 PM 2
Share

You lucky bastard.. I cant up-vote this, or any other answers at all. Well, there is (again) +1 for Eric5h5 in my $$anonymous$$d :)

Btw there is actually new version of ArrayPrefs: http://wiki.unity3d.com/index.php/ArrayPrefs2

avatar image W4rf4c3 · Mar 15, 2016 at 01:25 PM 2
Share

Please delete this accepted answer or update the link since this one is dead.

avatar image
7

Answer by franbat · Aug 18, 2015 at 04:25 AM

I had the same problem and I thought the solution:

 public int [] puntaje;
 for(int i=0;i<puntaje.Length;i++){
                 PlayerPrefs.SetInt("Puntaje"+i,puntaje[i]);
             }
             for(int i=0;i<puntaje.Length;i++){
                 print(PlayerPrefs.GetInt("Puntaje"+i));
             }


Comment
Add comment · Show 2 · 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 Eric5h5 · Aug 18, 2015 at 04:52 AM 0
Share

That creates a separate entry for each item, though, and there's no indication of how many items are in the array, so it's easy to break. ArrayPrefs2 is more efficient, more robust, and simpler to use.

avatar image ozgurdugmeci · Sep 19, 2015 at 03:53 PM 0
Share

this trick was very helpful. thanks franbat.

avatar image
0

Answer by samf1111 · Jul 20, 2020 at 12:04 AM

my solution was to store my variables in a string and separate them with '\n'. it only works for strings that have no '\n's in them though.

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

8 People are following this question.

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

Related Questions

[SOLVED] Problem with "foreach". 1 Answer

Trying to save/load from PlayerPrefs to Array and vice-versa 1 Answer

Manipulate arrays in Inspector with Editor Script? 2 Answers

Array problem -3 Answers

Access a String array in one script from another script 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