Skip to content

Commit

Permalink
Fix Il2Cpp.GC.choose for Unity 2021.1 and above (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
vfsfitvnm committed Mar 28, 2023
1 parent f16a37f commit 11ef6d6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/il2cpp/structs/gc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,14 @@ class Il2CppGC {

const reallocCallback = new NativeCallback(realloc, "pointer", ["pointer", "size_t", "pointer"]);

Il2Cpp.GC.stopWorld();

const state = Il2Cpp.Api._livenessAllocateStruct(klass.handle, 0, chooseCallback, NULL, reallocCallback);
Il2Cpp.Api._livenessCalculationFromStatics(state);
Il2Cpp.Api._livenessFinalize(state);

Il2Cpp.GC.startWorld();

Il2Cpp.Api._livenessFreeStruct(state);
} else {
const onWorld = new NativeCallback(() => {}, "void", []);
Expand Down

0 comments on commit 11ef6d6

Please sign in to comment.