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
2
Question by ForgeStudios · Aug 30, 2013 at 08:51 PM · javascriptplayerprefssecurityencryption

PlayerPrefs: Credebility, Advantages/Disadvantages

I am currently considering different measure of saving variables in my game, and playerprefs looks like a really easy and secure method of saving, but before I delve into using it I want to make sure that it's not all too good to be true. My first question is how credible is the data saved by playerprefs? Is it possible that someone who plays my game can easily go and modify value to help themselves cheat? Is the data encrypted or well hidden enough that the effort would be too much for the average computer user or gamer? Is the data "permanent"? will it be there if your computer restarts, or if my game closes. Next I am curious about the advantages and disadvantages to playerprefs. Is it slow? Is it bulky?

Comment
Add comment · Show 1
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 getyour411 · Aug 30, 2013 at 09:05 PM 2
Share

Using the defaults, PlayerPrefs is stable and permanent it will be there when your computer restarts, game closes, etc. However, any little bit of Googling will reveal that hierarchy it lives under in the registry and thus it's trivial to hack it/cheat.

1 Reply

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

Answer by Bunny83 · Aug 30, 2013 at 09:25 PM

The PlayerPrefs (short for Player Preferences where player refers to the UnityPlayer) are just a way to store any data on the clients machine. The main goal is to provide a solution that works on all platforms (web / standalone / mobile / ...). The implementation varies and it is generally not considered as "safe". As the name suggests it's primarily ment for storing preferences like player name, volume settings, quality settings, ... However it can be used for any kind of data.

The PlayerPrefs are not encrypted or protected against modifications. Actually it's impossible to make something "safe" when it is stored and processed on a client. You should ask yourself what level of security you need and how you actually measure it ;)

Just some hints: Standalone and webbuilds can be quite easily decompiled, so almost any encryption you implement on the client can be broken. On mobile it's a bit more difficult, but if on Android with a rooted device nothing is impossible.

To prevent 90% of all scriptkiddy attacks you could save a hash value along with the actual data. This would make simple editing a bit difficult. If you have any real sensitive data, store it on a server.

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 ForgeStudios · Aug 30, 2013 at 09:29 PM 0
Share

Understood. The data at hand is too important, I just need to put it out of reach of the average gamer. Also, I never asked, but how well does playerprefs handle alot of quires at once. For example: I need to load and save a scene with 300 items+, is that too much?

avatar image neogamesproduct · Aug 30, 2013 at 09:44 PM 0
Share

I thing PlayerPrefs is a good method for a basic save/load but i think the X$$anonymous$$L serilization more useful and capable. However , i'll go with the PlayerPrefs : it's easy and useful yes , but X$$anonymous$$L and PlayerPrefs are similar ... my opinion is creating yourself your save/load system ...

avatar image ForgeStudios · Aug 30, 2013 at 11:46 PM 0
Share

I've considered that. But creating my own method is a sizable amount of work. Currently, I just want a solution, but my project over all is a learning experience, so I might one day turn to saving and loading data. Right now I have alot of other things to work on though.

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

19 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

Related Questions

Player Pref Security - iOS 2 Answers

How to secure playerprefs and keep people from changing it? 1 Answer

Concerns about browser security due to making javascript calls to game from browser. 1 Answer

[SOLVED] Help with PlayerPrefs.SetInt 1 Answer

Cannot convert int to String 2 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