Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
2
Question by sandworm · Oct 11, 2011 at 10:42 PM · accesspropertyoverwriteplistdirect

Editing PlayerPrefs directly in plist

In Unity on OSX I am trying to edit the PlayerPrefs values in the unity.companyName.productName.plist, but every time I start the game they get overwritten with the old values. Is there a way to do this directly?

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 madcalf · Oct 18, 2011 at 04:24 AM 0
Share

I'm trying to figure out this exact same thing. We're trying to use the PlayerPrefs file as a settings file, where the desired values can be entered/edited directly in the file. I even added a bunch of settings to the file manually. But Unity did not even read them. It only seems to read items that were set by Unity. Even when it's set via Unity, if the plist is updated manually, Unity will somehow still see the Unity set value for that key, and not the manually altered value. And setting any key from Unity, seems to wipe out any manually entered keys that were previously saved there. Weird! If anyone has any ideas, it would be super appreciated! Thanks much!

avatar image syclamoth · Oct 18, 2011 at 04:36 AM 0
Share

That's weird. That implies that Unity keeps a separate, secret settings file somewhere else that it can use for backups!

2 Replies

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

Answer by Eric5h5 · Oct 18, 2011 at 04:49 AM

Quit the Unity editor before editing the .plist file.

Comment
Add comment · Show 4 · 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 syclamoth · Oct 18, 2011 at 04:52 AM 1
Share

What that's it? I thought there was some kind of mystery here...

avatar image sandworm · Oct 18, 2011 at 05:31 AM 0
Share

$$anonymous$$inda sucks to have to exit each time, but thanks!

avatar image madcalf · Oct 18, 2011 at 06:48 AM 1
Share

Sweeeeet! That did the trick. Thanks much Eric!
For anyone using the PropertyListEditor (PLE) on $$anonymous$$ac OS X, here are some things i've figured out that might help, or at least save you some pain:
- You can use booleans in the plist, if you read them using PlayerPrefs.GetInt()
- Using the wrong Unity function for the data type in the plist usually results in 0 being returned. $$anonymous$$g. using GetInt() to read 3.543
- If you enter a number in your plist as 2.0 (because you intend to read it as a float), the PLE removes the decimal value, leaving you with 2!! PlayerPrefs.GetInt() will read that, but PlayerPrefs.GetFloat() will return 0. Sucks if you need that value to be a float. I might end up setting up all my number values as strings in the plist and just parse them via float.Parse() or int.Parse() as needed. $$anonymous$$ind of annoying to have to do that, tho...
- Good idea to save a backup of your plist if you've manually created it, just in case you forget to close Unity while editing the pList and end up wiping out all your manually entered keys!
Thanks again!

avatar image Russel · Oct 28, 2013 at 11:25 AM 0
Share

I still have the problem with Unity 4.2.2f1 . The file is always overwritten. Quit and restart the application don't work.

avatar image
8

Answer by aayars · Feb 01, 2014 at 10:00 PM

Spent some time battling with this, and learned that OS X Mavericks caches prefs in memory. Any manual edits to the plist are ignored. In addition to editing the plist while Unity is closed, you must also invalidate the cache. In my experience, this works:

Quit Unity, make your edit, and then issue these commands in a terminal:

defaults read ~/Library/Preferences/your.plist.here

defaults read your.plist.here

Yes, both commands, and obviously replace your.plist.here with the filename of your plist. Bonus points: make a backup of your plist before trying any of this.

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 MrCranky · Mar 19, 2014 at 03:31 PM 0
Share

$$anonymous$$an this has been annoying me for ages. I didn't need the second defaults read command, but otherwise it worked a treat.

avatar image begray · Sep 10, 2014 at 08:57 AM 0
Share

can't upvote it, but at least i'll leave a comment here: you've saved my day with this 'defaults' command. thanks.

avatar image orb · Sep 10, 2014 at 09:10 AM 0
Share

Using the defaults command is the correct answer since $$anonymous$$avericks, due to all the voodoo caused by cfprefsd.

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

How to retrieve GUIX element property? 1 Answer

Access local method variable in derived class 2 Answers

Load plist in Unity 3d running on a Windows machine 0 Answers

Material doesn't have a color property '_Color' 4 Answers

Unable to edit PropertyField's in my custom editor 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