• 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 jade1209 · May 01, 2017 at 01:37 PM · c#unity 5serializationjsonhack

How to protect JSON file game data?

Hi, I'm working an RPG game which have the data for various monster types and I considered using JSON to store the data. I've watch this tutorial https://unity3d.com/learn/tutorials/topics/scripting/game-data-editor-gui?playlist=17117

However, I found (10.54 in the video above) that it is so easy to change the JSON file from StreamingAssets folder in Unity. So, my question is how can I make JSON file safe from being edited?

I know that the determined hackers can finally hack my game anyway but I don't want it to be as easily as shown in the tutorial video above. I've searched for around the web many hours but not found a single solution other than put JSON file on the server. If you have any other alternative solution, I'm glad to hear it as well :)

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by UnityCoach · May 01, 2017 at 09:04 PM

The whole point of using JSon/xml etc, is to make files editable elsewhere. You can use binary otherwise.

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 jade1209 · May 03, 2017 at 06:30 AM 0
Share

Thank you for your reply. I will try to implement the binary.

avatar image BlueRanger117 · Oct 12, 2017 at 03:26 PM 1
Share

I wouldn't use Binary if you plan to export to Window Store. I've got a problem now where using System.Runtime.Serialization.Formatters.Binary; isn't supported on that platform, so now I have to redo my whole game save system.

https://forum.unity.com/threads/uwp-build-error-namespace-formatters-does-not-exist.422308/

http://answers.unity3d.com/questions/870958/need-help-regarding-systemruntimeserializationform.html

avatar image pikachuk BlueRanger117 · Oct 12, 2017 at 03:38 PM 0
Share

i would recomand to use SharpSerializer ins$$anonymous$$d, it's a great library that allows to serialize to binary and json even on platforms that doesn't have system.runtime.serialization.formatters

avatar image
0

Answer by BodhiPurplePill · May 01, 2017 at 02:07 PM

Use persistent datapath instead of streamingassets (a little more hidden location to save your file)

A json is a string, you could swap some characters with a keyword like here: http://stackoverflow.com/questions/23780833/c-sharp-very-simple-string-encryption-for-game

You could also do the same for the bytes in the file.

You could use a long keyword for this or (for example) the device's unique id (to avoid copying saves)

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 jade1209 · May 03, 2017 at 06:32 AM 0
Share

Thank you for your reply. I think it may suit with my game!

avatar image
0

Answer by Shugabush · Jan 19 at 12:47 AM

I think if you edit the json file data in windows explorer, it won't actually change the data (at least on the build).

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

11 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

Related Questions

JsonUtility doesn't serialize nested mixed var 1 Answer

unity 3d loading data from json problem?! 1 Answer

Coding help: How to use xml serialization 1 Answer

Handling inheritance with JSONUtility.ToJSON 1 Answer

Parsing multiple json files that are referencing each other 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