Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by castor · Nov 30, 2015 at 06:23 AM · variableshideassembliesobfuscation

Obfuscate variables in release build?

I know that anyone with enough time and skill will always be able to read the code from your game and that is not something I really worry about. My issue is that my game is very story driven and there are some puzzles that players are supposed to be stuck for a long time, and if you are able to read the code, you can solve them pretty fast...

So the only thing I really need is for variable names to be scrambled in a way they don't make sense if someone decompiles the Assemblies with a tool like ILSpy (which would take like 5 minutes of effort). After that, if someone digs further than I don't really care.

Is this possible? Any suggestions? Would it even be possible to do in the source code, rather than the assemblies? Does Unity provide any protection for this?

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
0

Answer by phxvyper · Nov 30, 2015 at 11:33 AM

Is the game single player? Is there a leaderboard? If there is no leaderboard, then logically speaking there isn't much of a reason to protect against cheaters like that.

The majority of people don't know how to decompile .NET or Mono assemblies anyway, so that's okay.

Also, when you compile C# via Mono or .NET, the IL code that is generated is basically already obfuscated, and it becomes very very difficult to read it. Variable names are almost always very weird and the only way to actually figure out what code is doing what is to read it - ALL OF IT.

So, in short: don't worry! Its highly unlikely that anyone will manage to solve your puzzles via cheating. Besides, someone might post the solution online and someone else might use that solution. You can't protect against that (usually).

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 castor · Nov 30, 2015 at 10:15 PM 0
Share

The issue is not cheaters and the game is only single-player without any leaderboards. If you use something like ILSpy its EXTRE$$anonymous$$ELY easy to read all the scripts inside the Assemblies. It literally takes a few $$anonymous$$utes and doesn't require any advanced knowledge.

I know that probably someone will post a walk through immediately but still I would like to hide it slightly better on my side.

Here is an example from the web of how well it reads the files... alt text

window.png (81.9 kB)
avatar image tanoshimi castor · Nov 30, 2015 at 11:00 PM 0
Share

Totally agree with @phxvyper - 99% of players won't know how to decompile your code. The 1% that can will also be tech-savvy enough to be able to unobfuscate it as well (or, tbh, cheat your game in other trivial ways), and once story-driven puzzles are solved once, they can be solved by everybody.

If your game is not multiplayer or rewards-based, why does it matter if the player "cheats" in this way? I$$anonymous$$O, obfsucation makes your game much harder to manage, it has the potential to break any method calls such as calling coroutines by name, and is really not worth the effort.

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

32 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 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

Hide variables in PlayerPrefs 2 Answers

How can you hide variables within a region in a c# script? 1 Answer

Public variables not updating? 1 Answer

cleanup variables on editor BUG? 1 Answer

How to fix unstable boolean values? [possible bug] 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