Skip to content

Il2Cpp ​

Unity's IL2CPP scripting backend converts managed assemblies to C++ and compiles that code into a native binary. The game also uses global-metadata.dat, which describes managed types, methods, and fields. AssetRipper uses information from both the binary and the metadata to recover script definitions. If a custom IL2CPP build changes a format or layout that AssetRipper expects, script analysis may fail even when other assets can still be exported.

Changing the metadata format or native layout ​

  • Changing the magic bytes in global-metadata.dat: The magic bytes are a signature at the start of the file. Changing them can cause a reader to reject the file before it reads any metadata records.
  • Changing the metadata version number: Readers use this number to decide how to interpret the metadata. A custom number, such as a single-digit value, may be rejected as unsupported. Depending on the Unity version, the runtime's version check is in GlobalMetadata.cpp or MetadataCache.cpp. This number is separate from the Unity Editor version.
  • Reordering fields in IL2CPP structs: Reordering fields can change their byte offsets in the native binary. A reader that assumes the standard layout may read the wrong data even if it recognizes the metadata file.

Keeping the game working ​

The metadata your build produces must agree with what the runtime expects. For example, changing only the metadata signature or version number can cause the runtime itself to reject the file. When changing a struct layout, rebuild any native code that depends on that layout. Test a built player on each target platform, not just in the Unity Editor, and check that scenes and prefabs with scripts still load correctly.

These changes can prevent AssetRipper from analyzing a build as distributed, but they do not make analysis impossible. The game still needs to interpret its own metadata and native structures, and a tool adapted to the custom format may be able to do the same.