• Hello
Search Results for

    Show / Hide Table of Contents

    Obfuscation - Settings

    The first of the four settings tabs. Here you'll find general settings for code obfuscation, including which assemblies should be obfuscated, as well as detailed options for obfuscating their classes and members.

    Assembly - Settings

    Manage which assemblies should be obfuscated.

    Figure 1 - Manage here the assemblies that should be obfuscated.

    You'll find the following settings:

    • Obfuscate Assembly-CSharp: Obfuscate the default Unity assembly Assembly-CSharp.dll. It contains code that was not added to a sub-assembly through an Assembly Definition File.
    • Obfuscate Assembly-CSharp-firstpass: Obfuscate the default Unity plugins assembly Assembly-CSharp-firstpass.dll. It contains code that was not added to a sub-assembly through an Assembly Definition File and lives inside a Plugins directory.
    • Obfuscate Assembly Definition File in 'Assets': Obfuscate the code in sub-assemblies defined through Assembly Definition Files located in the [Root]/Assets directory and its sub-directories.
    • Obfuscate Assembly Definition File in 'Packages': Obfuscate the code in sub-assemblies defined through Assembly Definition Files located in the [Root]/Packages directory and its sub-directories.
    • Obfuscate external assemblies: If you only want to obfuscate specific assemblies, or also include third-party assemblies, add them here.
    • Dependencies: If the Obfuscator fails to resolve a third-party dependency, add the full path of its directory here.

    Namespace - Settings

    Manage the obfuscation of namespaces and their classes.

    Figure 2 - Manage here the obfuscation of namespaces and their classes.

    You'll find the following settings:

    • Obfuscate Namespaces: Obfuscate the namespaces of classes. This option must be enabled to obfuscate MonoBehaviours.
    • Skip following Namespaces: Add namespaces you want to exclude from obfuscation. All classes and members inside these namespaces will be skipped. Entries are treated as prefixes, so entering GoogleSdk will also skip GoogleSdk.Lib.
    • Vice Versa Namespaces Skipping: Reverses the namespace skipping. When enabled, only classes and their members inside the listed namespaces will be obfuscated.

    Class - Settings

    Manage the obfuscation of classes.

    Figure 3 - Manage here the obfuscation of classes.

    You'll find the following settings:

    • Obfuscate (Internal/Private/Protected/Public): Obfuscate class names based on their accessibility.
    • Obfuscate Abstract Classes: Obfuscate the names of abstract classes.
    • Obfuscate Generic Classes: Obfuscate the names of generic classes.
    • Obfuscate Serializable Classes: Obfuscate the names of serializable classes and their fields. Only recommended if data is serialized at runtime and after obfuscation. Otherwise the names inside the serialized class will no longer match, causing errors.
    • Obfuscate Structs: Obfuscate struct names. Be careful if the struct is saved in Unity data, JSON, or another save format.
    • Obfuscate Enums: Obfuscate enum type names. Be careful if enum names are stored as text.
    • Obfuscate Delegates: Obfuscate delegate names. Be careful if delegate names are used by reflection or serialized data.
    • Obfuscate MonoBehaviour Sub-Classes: Obfuscate the names of MonoBehaviour classes. Requires namespace obfuscation to be enabled.
    • Obfuscate MonoBehaviour Sub-Classes in external Assemblies: Obfuscate the names of MonoBehaviour classes in third-party or pre-compiled assemblies. Requires namespace obfuscation to be enabled.
    • Obfuscate ScriptableObject Sub-Classes: Obfuscate the names of ScriptableObject classes and their fields. Only recommended if you do not serialize ScriptableObjects into .asset files or assign values through the Unity Inspector. Otherwise the names of saved and obfuscated data will no longer match, causing errors.
    • Obfuscate Playable Sub-Classes: Obfuscate the names of Playable classes.

    Safe workflow for Unity classes

    Unity scenes, prefabs, and .asset files often store class and field names. This is normal Unity behavior. If you rename those classes or fields during obfuscation, Unity may not be able to connect saved data to the new names.

    Use this workflow when enabling MonoBehaviour, ScriptableObject, serializable class, public field, or [SerializeField] obfuscation:

    1. Start with the default settings.
    2. Enable one extra setting at a time.
    3. Build the game.
    4. Test scenes, prefabs, UI buttons, save/load, Addressables, and networking.
    5. If something breaks, keep the affected name stable with DoNotRename, DoNotObfuscateClass, or namespace skipping.
    6. If you need stable names across multiple builds, enable mapping save and load in the Optional tab.
    Note

    Inspector-assigned values are the most common place where Unity projects need extra care. If a field is assigned in the Inspector, consider keeping that field name unchanged unless you have tested the final build.

    Method - Settings

    Manage the obfuscation of methods.

    Figure 4 - Manage here the obfuscation of methods.

    You'll find the following settings:

    • Obfuscate (Internal/Private/Protected/Public): Obfuscate method names based on their accessibility.
    • Obfuscate Unity Methods: This row is currently disabled in the Editor and marked for revision. Unity message methods such as Awake, Start, and Update should keep their normal names unless this feature becomes available again in a future version.

    Parameter - Settings

    Manage the obfuscation of parameters.

    Figure 5 - Manage here the obfuscation of parameter.

    You'll find the following settings:

    • Obfuscate Method Parameter: Obfuscate generic method parameters. Regular parameters have no 'name' in built code – only IDs – so obfuscation is neither required nor possible.
    • Obfuscate Class Parameter: Obfuscate generic class parameters.

    Field - Settings

    Manage the obfuscation of fields.

    Figure 6 - Manage here the obfuscation of fields.

    You'll find the following settings:

    • Obfuscate (Internal/Private/Protected/Public): Obfuscate field names based on their accessibility.
    • Obfuscate Serializable Fields: Obfuscate the names of serializable fields in 'MonoBehaviour/ScriptableObject' classes – those marked with the 'SerializeField' attribute. Only recommended if data is serialized at runtime and after obfuscation, and is not assigned through the Unity Inspector. Otherwise the names inside the serialized class will no longer match, causing errors.
    • Obfuscate Unity Public Fields: Obfuscate the names of public fields in 'MonoBehaviour/ScriptableObject' classes. Only recommended if data is serialized at runtime and after obfuscation, and is not assigned through the Unity Inspector. Otherwise the names inside the serialized class will no longer match, causing errors.
    • Obfuscate Enum Values: Obfuscate the names of fields inside enums.

    Property - Settings

    Manage the obfuscation of properties.

    Figure 7 - Manage here the obfuscation of properties.

    You'll find the following settings:

    • Obfuscate (Internal/Private/Protected/Public): Obfuscate property names based on their accessibility.

    Event - Settings

    Manage the obfuscation of events.

    Figure 8 - Manage here the obfuscation of events.

    You'll find the following settings:

    • Obfuscate (Internal/Private/Protected/Public): Obfuscate event names based on their accessibility.
    In This Article
    Back to top GuardingPearSoftware documentation