Skip to content

Commit

Permalink
[unity]重构后il2cpp版本的编译问题
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Apr 8, 2024
1 parent 75db0c5 commit 3271d4d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions unity/native_src_il2cpp/Src/Puerts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,19 +706,20 @@ struct JSEnv
#endif
v8::V8::SetFlagsFromString(Flags.c_str(), static_cast<int>(Flags.size()));

MainIsolate = BackendEnv.CreateIsolate(nullptr);
BackendEnv.Initialize();
MainIsolate = BackendEnv.MainIsolate;

auto Isolate = MainIsolate;

v8::Isolate::Scope Isolatescope(Isolate);
v8::HandleScope HandleScope(Isolate);

v8::Local<v8::Context> Context = v8::Context::New(Isolate);
v8::Local<v8::Context> Context = BackendEnv.MainContext.Get(Isolate);;
v8::Context::Scope ContextScope(Context);

MainContext.Reset(Isolate, Context);

BackendEnv.InitInject(MainIsolate, Context);
BackendEnv.InitInject();
CppObjectMapper.Initialize(Isolate, Context);
Isolate->SetData(MAPPER_ISOLATE_DATA_POS, static_cast<ICppObjectMapper*>(&CppObjectMapper));
Isolate->SetData(BACKENDENV_DATA_POS, &BackendEnv);
Expand Down Expand Up @@ -784,7 +785,7 @@ struct JSEnv
}

MainContext.Reset();
BackendEnv.FreeIsolate();
BackendEnv.UnInitialize();
}

v8::Isolate* MainIsolate;
Expand Down

0 comments on commit 3271d4d

Please sign in to comment.