Skip to content

Fix IL2CPP build crash on Unity 6000.0.x caused by multiple implement…#203

Merged
sierpinskid merged 1 commit intodevelopfrom
feature/uni-166-fix-il2cpp-android-compilation-issue
Apr 10, 2026
Merged

Fix IL2CPP build crash on Unity 6000.0.x caused by multiple implement…#203
sierpinskid merged 1 commit intodevelopfrom
feature/uni-166-fix-il2cpp-android-compilation-issue

Conversation

@sierpinskid
Copy link
Copy Markdown
Member

…ations of the same generic interface

IL2CPP's vtable builder in Unity 6000.0.x crashes with a KeyNotFoundException in VTableBuilderComponent.OverrideInterfaceMethods when a type implements multiple closed versions of the same generic interface (e.g. ISavableTo and ISavableTo). The vtable builder uses an unresolved generic parameter name as a dictionary key instead of the resolved concrete type, causing a key mismatch during vtable construction. The bug is fixed in Unity 6000.2.x but affects customers on 6000.0.x.

This pattern existed across four internal generic interfaces in the SDK: ISavableTo (9 types), ILoadableFrom (9 types), IUpdateableFrom (4 types), and IStateLoadableFrom (5 types) — 27 types total.

Fix: for each interface, introduce numbered variants (e.g. ISavableTo2, ILoadableFrom2/3/4, IUpdateableFrom2/3/4/5, IStateLoadableFrom2) that are structurally identical but distinct in the type system. Each type's secondary and tertiary implementations are moved to the numbered variant, so no type ever implements multiple closed versions of the same generic interface. Matching extension method overloads ensure all existing functionality and DTO conversions are preserved.

…ations of the same generic interface

IL2CPP's vtable builder in Unity 6000.0.x crashes with a KeyNotFoundException in VTableBuilderComponent.OverrideInterfaceMethods when a type implements multiple closed versions of the same generic interface (e.g. ISavableTo<A> and ISavableTo<B>). The vtable builder uses an unresolved generic parameter name as a dictionary key instead
of the resolved concrete type, causing a key mismatch during vtable construction. The bug is fixed in Unity 6000.2.x but affects customers on 6000.0.x.

This pattern existed across four internal generic interfaces in the SDK: ISavableTo (9 types), ILoadableFrom (9 types), IUpdateableFrom (4 types), and IStateLoadableFrom (5 types) — 27 types total.

Fix: for each interface, introduce numbered variants (e.g. ISavableTo2, ILoadableFrom2/3/4, IUpdateableFrom2/3/4/5, IStateLoadableFrom2) that are structurally identical but distinct in the type system. Each type's secondary and tertiary implementations are moved to the numbered variant, so no type ever implements multiple closed versions of the
same generic interface. Matching extension method overloads ensure all existing functionality and DTO conversions are preserved.
@sierpinskid sierpinskid merged commit df891ed into develop Apr 10, 2026
30 of 32 checks passed
@sierpinskid sierpinskid deleted the feature/uni-166-fix-il2cpp-android-compilation-issue branch April 10, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant