Skip to main content

Method Body Obfuscation

Method body obfuscation is actually called code obfuscation. Some Obfuscation Passes for method body obfuscation in Obfuz have unified rules, so they are introduced separately in this document.

  • Constant obfuscation
  • Call obfuscation

Targets with Method Body Obfuscation Disabled by Default

Obfuz has made every effort to consider common scenarios in the Unity engine where method body obfuscation needs to be disabled. The following targets will not be obfuscated and will not be affected by rule files:

  • All code within the Obfuz.Runtime assembly will not be obfuscated
  • Types with names containing the $Obfuz$ prefix are generated by Obfuz, and all their member method bodies will not be obfuscated
  • Functions with names containing the $Obfuz$ prefix are generated by Obfuz, and their method bodies will not be obfuscated
  • All method bodies of the Obfuz.EncryptionVM.GeneratedEncryptionVirtualMachine class will not be obfuscated
  • Method bodies marked with [RuntimeInitializeOnLoadMethod] and with loading timing equal to or earlier than RuntimeInitializeLoadType.AfterAssembliesLoaded will not be obfuscated
tip

Only method body obfuscation is disabled, function names may still be obfuscated. [RuntimeInitializeOnLoadMethod] is an exception, as symbol obfuscation gives special treatment to such functions and does not obfuscate their function names and class names.