Skip to main content

Configuration

Obfuz provides extremely rich configuration options and flexible obfuscation rule configuration files to support various complex requirements of commercial game projects.

ObfuzSettings Window

Click the menu Obfuz/Settings... to open the ObfuzSettings window.

Global Settings

OptionDescription
Build Pipeline SettingsBuild pipeline related settings
Assembly SettingsObfuscation assembly related settings
Obfuscation Pass SettingsObfuscation Pass related settings
Secret SettingsEncryption related settings
Encryption VM SettingsEncryption virtual machine related settings
Garbage Code Generation SettingsGarbage code generation related settings

Build Pipeline Settings

Set build pipeline related parameters.

OptionDescription
EnableWhether to enable Obfuz obfuscation functionality. If disabled, Obfuz will no longer obfuscate assemblies during the build process, but it will not affect developers actively calling obfuscation interfaces to obfuscate certain assemblies.
Link Xml Process Callback OrderCallbackOrder of LinkXmlProcess. Default value is 10000
Obfuscation Process Callback OrderCallbackOrder of ObfuscationProcess. Default value is 10000

Assembly Settings

Set obfuscation related assemblies. Additional documentation can be found in Assembly.

OptionDescription
Assembly To ObfuscateList of assembly names that need to be obfuscated. Assembly names do not include .dll, examples: Main, Assembly-CSharp. If you want to obfuscate Obfuz.Runtime, please enable the Obfuscate Obfuz Runtime option below, do not add it to this list!
Non Obfuscated But Referenceing Obfuscated AssembliesList of assembly names that do not need to be obfuscated but reference obfuscated assemblies
Additional Assembly Search PathsRelative search paths for assemblies existing in dll form. Currently Obfuz automatically searches for managed dlls within the project that are compatible with the current buildTarget (including Assets, Packages, and Library/PackageCache), so this item generally does not need to be configured. Unless managed dlls are outside the Unity project, or there are multiple dlls with the same name requiring search priority resolution.
Obfuscate Obfuz RuntimeWhether to obfuscate the Obfuz.Runtime assembly. Default is true, strongly recommend enabling this option.

Obfuscation Pass Settings

Set which Obfuscation Passes to enable. Supports refinement to function or field level. Additional documentation can be found in Obfuscation Pass.

OptionDescription
Enabled PassesGlobally enabled Obfuscation Pass combinations. If a Pass is not enabled in Enabled Passes, it will be ignored even if configured in Rule Files
Rule FilesConfiguration rule files, detailed documentation can be found in Obfuscation Pass

Secret Settings

Encryption related global settings. Additional documentation can be found in Encryption.

OptionDescription
Default Static Secret KeyDefault static key. Due to initialization timing limitations, AOT assemblies generally can only use static keys. If AOT assemblies are obfuscated, please do not modify this value after publishing the App.
Default Dynamic Secret KeyDefault dynamic key. Keys that are allowed to be loaded only after completing some events (such as code hot updates) after startup. Generally can only be used for dynamically updated assemblies like hot update assemblies. This value can be modified before each hot update.
StaticSecretKeyOutputPathDefault output directory for default static key documents.
DynamicSecretKeyOutputPathDefault output directory for default dynamic key documents.
Random SeedRandom number seed. This seed affects all obfuscation and encryption operations, recommended to change regularly. This value can be modified before each App release or hot update.

Encryption VM Settings

Encryption Virtual Machine related settings. Additional documentation can be found in Encryption.

OptionDescription
Code Generation Secret KeyStarting random number key and seed used to generate the virtual machine. Please do not modify this value after publishing the App.
Encryption Op Code CountNumber of instructions for the encryption virtual machine. Its value must be a power of 2 and not less than 64, default value is 256. Recommended not to exceed 1024. Please do not modify the value after publishing the App.
Code Output PathOutput path for generated encryption virtual machine code. Default is Assets/Obfuz/GeneratedEncryptionVirtualMachine.cs. The encryption virtual machine is globally unique. If AOT assemblies are obfuscated, due to initialization timing reasons, the encryption virtual machine code must be placed in AOT assemblies. If only hot update code is obfuscated, EncryptionVM code can also be placed in hot update assemblies.

Garbage Code Generator Settings

Garbage code generator related settings. Detailed documentation can be found in Garbage Code Generation.

OptionDescription
Code Generation Secret KeyIndependent key used for generating garbage code
Default TaskDefault generation task
Additional TasksAdditional optional generation tasks. Each task has exactly the same structure as DefaultTask

Task field descriptions:

OptionDescription
Code Generation Random SeedRandom generator seed used for generating garbage code
Class NamespaceNamespace of generated garbage code classes
Class Name PrefixClass name prefix of generated garbage code classes. The final generated class names are {class name prefix}_1, {class name prefix}_2, etc.
Class CountNumber of generated garbage classes
Method Count Per ClassNumber of functions in garbage classes
Field Count Per ClassNumber of fields in garbage classes
Garbage Code TypeType of generated garbage class code. Different types generate significantly different code
Output PathOutput path for garbage code

Currently supports multiple encryption or obfuscation passes, detailed documentation can be found in Obfuscation Pass.

Symbol Obfus Settings

Symbol obfuscation is used to obfuscate names of types, fields, functions, properties, events, and function parameters in assemblies. Supports very fine control of obfuscation scope and effects through rule files. Detailed documentation can be found in Symbol Obfuscation.

OptionDescription
DebugWhether to enable Debug mode. When Debug mode is disabled, {Name} will be obfuscated to names like $a. When Debug mode is enabled, {Name} will be consistently obfuscated to ${Name} (e.g., Apple will be obfuscated to $Apple) to facilitate issue tracking. Debug mode ignores all obfuscation rules and also ignores the symbol mapping file symbol-mapping.xml.
Obfuscated Name PrefixPrefix for obfuscated names, will add this prefix to all generated obfuscated symbols. Default is $. Although configuring it as empty does not affect generating non-conflicting obfuscated names, adding a prefix helps quickly distinguish normal names from obfuscated names
Use Consistent NamespaceWhether to generate the same obfuscated Namespace for the same Namespace. Default is true. If false, even namespaces with the same name will be mapped to different obfuscated namespaces. For empty Namespace, it remains empty after obfuscation rather than generating an obfuscated Namespace for it
Keep Unknown Symbol In Symbol Mapping FileWhether to keep unknown symbol mapping records in the symbol mapping file. Default is true. The symbol mapping file output during hot update obfuscation contains complete records, but during the build process, due to Unity's trimming behavior, some metadata is trimmed and cannot be found in the symbol mapping file. If these records are removed from the symbol mapping file, it will cause the symbol mapping generated during build to be unstable.
Detect Reflection CompatibilityWhether to detect compatibility issues in reflection code. Default is true. If true, it will scan all reflection operations and print errors or warnings if incompatible with symbol obfuscation. Detailed documentation can be found in Symbol Obfuscation
Symbol Mapping FileObfuscated symbol mapping file that records the mapping relationship between original names and obfuscated names of symbols like types, functions, fields, etc. When Debug mode is disabled, obfuscated symbols will prioritize using obfuscated names recorded in symbolMappingFile while ensuring no naming conflicts, ensuring stability of incremental mapping. Additionally, symbolMappingFile is also used by the DeobfuscateStackTrace tool to restore obfuscated function stack logs to original function stack logs. To ensure stability of incremental obfuscation, please add symbolMappingFile to version control
Debug Symbol Mapping FileObfuscated symbol mapping file used when Debug mode is enabled, recording the mapping relationship between original names and obfuscated names of symbols like types, functions, fields, etc. In Debug mode, mapping relationships will not be read from debugSymbolMappingFile, but mapping relationships will be saved to debugSymbolMappingFile after obfuscation is completed. debugSymbolMappingFile is also used by the DeobfuscateStackTrace tool to restore obfuscated function stack logs to original function stack logs.
Rule FilesObfuscation rule configuration files. If empty, all symbols except special symbols will be obfuscated. Detailed configuration rules can be found in Symbol Obfuscation.
Custom Rename Policy TypesList of custom symbol obfuscation policy class full names. Since type full names do not include assembly names, type full names must be unique across all assemblies in the AppDomain. Detailed configuration rules can be found in Symbol Obfuscation.

Const Encrypt Settings

Constant encryption related settings. Supports very fine control of scope and encryption effects through rule files. Additional documentation can be found in Constant Obfuscation.

OptionDescription
Encryption levelEncryption level, value range is [1, 4], default is 1. Higher encryption level means more complex encryption and more time-consuming decryption.
Rule FilesList of encryption rule files. Can be 0 to multiple. If empty, all constants will be obfuscated. Detailed configuration rules can be found in Constant Obfuscation.

Remove Const Field Settings

Remove const constant field related settings. Supports fine control of which const fields to keep through rule files. Additional documentation can be found in Remove Constant Fields.

OptionDescription
Rule FilesList of encryption rule files. Can be 0 to multiple. If empty, all constants will be obfuscated. Detailed configuration rules can be found in Remove Constant Fields.

Eval Stack Obfus Settings

Execution stack obfuscation settings. Supports very fine control of scope and encryption effects through rule files. Additional documentation can be found in Eval Stack Obfuscation.

OptionDescription
Rule FilesList of encryption rule files. Can be 0 to multiple. If empty, all constants will be obfuscated. Detailed configuration rules can be found in Eval Stack Obfuscation.

Expr Obfus Settings

Expression obfuscation related settings. Supports very fine control of scope and encryption effects through rule files. Additional documentation can be found in Expression Obfuscation.

OptionDescription
Rule FilesList of encryption rule files. Can be 0 to multiple. If empty, all constants will be obfuscated. Detailed configuration rules can be found in Expression Obfuscation.

Field Encrypt Settings

Variable memory encryption related settings. Supports very fine control of encryption scope and effects through rule files. Additional documentation can be found in Field Encryption.

OptionDescription
Encryption levelEncryption level, value range is [1, 4], default is 1. Higher encryption level means more complex encryption and more time-consuming decryption.
Rule FilesList of encryption rule files. Can be 0 to multiple. If empty, all constants will be obfuscated. Detailed configuration rules can be found in Field Encryption.

Call Obfus Settings

Function call obfuscation related settings. Supports very fine control of encryption scope and effects through rule files. Additional documentation can be found in Call Obfuscation.

OptionDescription
Proxy ModeFunction call obfuscation method, detailed introduction can be found in Call Obfuscation.
Encryption levelEncryption level, value range is [1, 4], default is 1. Higher encryption level means more complex encryption and more time-consuming decryption.
maxProxyMethodCountPerDispatchMethodMaximum number of proxy functions each dispatch function can contain. Default is 100. Recommended that this value should not exceed 1000.
obfuscateCallToMethodInMscorlibWhether to obfuscate calls to functions in mscorlib. Default is false. This option and whitelist configuration in obfuscation rule files will take effect simultaneously. If this option is disabled or mscorlib is included in the whitelist assemblies, calls to functions in mscorlib assembly will not be obfuscated.
Rule FilesList of encryption rule files. Can be 0 to multiple. If empty, all constants will be obfuscated. Detailed configuration rules can be found in Call Obfuscation.

Control Flow Obfus Settings

Control flow obfuscation related settings. Supports very fine control of encryption scope and effects through rule files. Additional documentation can be found in Control Flow Obfuscation.

OptionDescription
Min Instruction Count Of Basic Block To ObfuscatedMinimum instruction count of basic blocks to be obfuscated
Rule FilesList of encryption rule files. Can be 0 to multiple. If empty, all constants will be obfuscated. Detailed configuration rules can be found in Call Obfuscation.

Watermark Settings

Code watermark related settings. Additional documentation can be found in Code Watermark.

OptionDescription
TextWatermark text embedded in code
Signature LengthHash signature length of embedded watermark text

PolyMorphic Dll Settings

Polymorphic dll related settings. Additional documentation can be found in Polymorphic dll Files.

OptionDescription
enableWhether to enable polymorphic dll support. When enabled, code supporting polymorphic dll will be generated in HybridCLR/ObfuzExtentions/GenerateAll.
codeGenerationSecretKeyRandomization key used when generating polymorphic dll code
disableLoadStandardDllWhether to disable loading standard structure dlls. When this option is enabled, Assembly.Load or RuntimeApi.LoadMetadataForAOTAssembly must pass polymorphic dlls. If standard dlls are passed, an error will be returned.