Skip to content

Fix Unity 6 native class resolver hooks - #31

Merged
Fernthedev merged 1 commit into
QuestPackageManager:masterfrom
FrozenAlex:fix/unity6-native-class-resolvers
Oct 18, 2026
Merged

Fernthedev merged 1 commit into
QuestPackageManager:masterfrom
FrozenAlex:fix/unity6-native-class-resolvers

Conversation

@FrozenAlex

Copy link
Copy Markdown

beatsaber-hook 9.3.0 separates its callable compatibility APIs from Unity's native class entry points. Custom-types still hooks the compatibility pointer addresses, so Unity's internal calls can bypass custom-type handling and fail during class initialization.

Update the Unity 6 hooks to target the native entry points with their actual signatures:

  • Hook Class_FromIl2CppTypeNative as Il2CppClass*(const Il2CppType*, bool), preserving throwOnError when forwarding ordinary types.
  • Hook Class_InitNative as void(Il2CppClass*), retaining the existing skip for registered custom classes.
  • Require beatsaber-hook ^9.3.0 and update the resolved dependency and artifact URLs. Earlier Unity branches retain their existing hook signatures.

Companion to beatsaber-hook #67, released in 9.3.0. Consumers can continue using the existing callable APIs.

Validation:

  • Clean NDK 29 ARM64 build and QMOD packaging against the published hook 9.3.0 package, without a local dependency override. The restored hook binary matches the published SHA-256 digest.
  • This exact src/register.cpp implementation was previously tested on Quest 3 / Beat Saber 1.45.3 / Unity 6000.3.19f1 with the companion hook changes: two fresh processes each passed 752 resolver checks and 3,048 checks across 277 registered custom classes, followed by 30 seconds without a fatal log entry.
  • User-confirmed in-game reloads, noticeboard scrolling, and custom-map entry/return passed. Logs recorded both reloads and two map-to-menu round trips in the same production process.

The headset tests used the previously built local hook/custom-types pair; this PR's fresh build against the published 9.3.0 artifact has not been separately deployed. Uncached generic error paths and the complete registered test suite were not exercised. An initial diagnostic-time crash during live observer patching was excluded; the corrected harness produced the clean repeat results above.

@FrozenAlex
FrozenAlex marked this pull request as ready for review October 18, 2026 02:07
@Fernthedev
Fernthedev merged commit 869bdc4 into QuestPackageManager:master Oct 18, 2026
1 check passed
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.

2 participants