Obfuscator Free and Pro are both designed to work out of the Box. So all you have to do is normally build your Game and after this happened the Obfuscator will do its job with the generated Assemblies.
But only some things have to be considered, so please read here!
When you get Errors, or something wont work look here!
1. Adjust Obfuscator Free and Pro
If you want to customize the way the obfuscator obfuscates your Assemblies open, inside in Unity, the window under “Window->Obfuscator Settings” . Here you can modify your obfuscation settings.
Here you will find three tabs. Each one from left to right allows more complex obfuscation.
The first one is the General tab. Define here the general obfuscation process. Define if the name of Namespaces (Pro only), Classes, Fields, Properties, Events and Methodes, shall get obfuscated.
At the bottom you find a List to define which Namespaces shall not get obfuscated. But beware, the added Elements are used as prefixes! So if you add ‘Unity.Samples’, all Namespaces beginning with ‘Unity.Samples’ will not get obfuscated. And never let there be an empty line. Because then, all Namespaces won’t get obfuscated.
The second one is the Advanced tab. Here you can even specify advanced options for Classes, Fields and Methods. You can seperate obfuscation for private/protected/public ones. And other advanced settings.
Important note: You find the ‘Obfuscate unity public field’ setting there, because you can modify public fields outside the source code, in the Unity Editor which the Obfuscator can not access. So if you define Scene GameObjects that are no Asset-Prefabs or differ with its settings from the Asset-Prefabs, Unity will later not find the correct fields, cause the obfuscator renamed them. So if you want to work with GameObjects that are no Asset-Prefabs, please deactivate this option.
The third tab is only available for Pro users. Here you can activate String obfuscation, adding Random code and the most advanced feature: Unreadability for Decompilers. This modifies classes in the way, that only the build unity game can fully access them. But attention, if you need others dlls to access the build and obfuscated dll, for example for modding, you either have to deactivate this settings or add to classes that shall be access extern an ‘Obfuscator.DoNotMakeClassUnDecompileAbleAttribute’.
2. How to with deal with Assets from Unity Asset Store.
If you use and work with Assets you did not programming/code by yourself please add those Assets namespaces on the “Ignore” List in the Obfuscator General Settings.
For example you use the UnityStandardAssets. Go in Unity3d Editor to “Window->Obfuscator Settings”. Go to the bottom in the setting window, add a new line if there is no one. And enter “UnityStandardAssets” (without quotes!). So all source code which namespaces start with “UnityStandardAssets” get ignored.
You will find a demo scenes and some demo files in the obfuscator directory. Check it out. At last, remove the demo folder, to build your Game! Or you will get errors!
You will find some Attributes to attach to classes/methodes/fields/… . You can use them to control the obfuscation process. Findable in the namespace ObfuscatorFree.Attribute or ObfuscatorPro.Attribute.
- The first one is: DoNotRenameAttribute
Attaching ‘DoNotRenameAttribute’ to any target will skip the renaming of this target.
- The second one is: DoNotObfuscateClassAttribute
Attaching ‘DoNotObfuscateClassAttribute’ to an class will skip the whole class with content. So nothing gets renamed. Even the namespace will not get obfuscated.
- The third one is: DoNotUseClassForFakeCodeAttribute
Attaching ‘DoNotUseClassForFakeCodeAttribute’ to an class will disallow random / fake code creation of this class.
- The fourth one is: DoNotMakeClassUnDecompileAbleAttribute
Attaching ‘DoNotMakeClassUnDecompileAbleAttribute’ to an class will skip this class in making it unreadable for disassembler.
Hope this helps. When not, do not be afraid to write me an eMail.