From 38f4b1d6c9f5f93ae89dba90a303fa6a2d81c0ee Mon Sep 17 00:00:00 2001 From: johnche Date: Tue, 15 Oct 2024 14:47:14 +0800 Subject: [PATCH] [unity]update p-api --- .../Resources/puerts/xil2cpp/pesapi.h.txt | 1 + .../puerts/xil2cpp/pesapi_adpt.c.txt | 163 +++++++++--------- unity/native_src_il2cpp/Inc/CppObjectMapper.h | 2 +- unity/native_src_il2cpp/Inc/ObjectMapper.h | 2 + unity/native_src_il2cpp/Inc/pesapi.h | 1 + .../native_src_il2cpp/Src/CppObjectMapper.cpp | 13 +- .../native_src_il2cpp/Src/PesapiAddonLoad.cpp | 4 +- unity/native_src_il2cpp/Src/PesapiV8Impl.cpp | 9 + unity/native_src_il2cpp/Src/Puerts.cpp | 4 +- 9 files changed, 106 insertions(+), 93 deletions(-) diff --git a/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/pesapi.h.txt b/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/pesapi.h.txt index e0dcae13f5..66fbcc76b5 100644 --- a/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/pesapi.h.txt +++ b/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/pesapi.h.txt @@ -144,6 +144,7 @@ PESAPI_EXTERN pesapi_value pesapi_create_binary(pesapi_env env, void* str, size_ PESAPI_EXTERN pesapi_value pesapi_create_array(pesapi_env env); PESAPI_EXTERN pesapi_value pesapi_create_object(pesapi_env env); PESAPI_EXTERN pesapi_value pesapi_create_function(pesapi_env env, pesapi_callback native_impl, void* data); +PESAPI_EXTERN pesapi_value pesapi_create_class(pesapi_env env, const void* type_id); PESAPI_EXTERN bool pesapi_get_value_bool(pesapi_env env, pesapi_value value); PESAPI_EXTERN int32_t pesapi_get_value_int32(pesapi_env env, pesapi_value value); diff --git a/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/pesapi_adpt.c.txt b/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/pesapi_adpt.c.txt index 608706b1dc..009c163403 100644 --- a/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/pesapi_adpt.c.txt +++ b/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/pesapi_adpt.c.txt @@ -94,6 +94,12 @@ pesapi_value pesapi_create_function (pesapi_env env, pesapi_callback native_impl return pesapi_create_function_ptr(env, native_impl, data); } +typedef pesapi_value (*pesapi_create_classType)(pesapi_env env, const void* type_id); +static pesapi_create_classType pesapi_create_class_ptr; +pesapi_value pesapi_create_class (pesapi_env env, const void* type_id) { + return pesapi_create_class_ptr(env, type_id); +} + typedef bool (*pesapi_get_value_boolType)(pesapi_env env, pesapi_value value); static pesapi_get_value_boolType pesapi_get_value_bool_ptr; bool pesapi_get_value_bool (pesapi_env env, pesapi_value value) { @@ -580,84 +586,85 @@ void pesapi_init(pesapi_func_ptr* func_array){ pesapi_create_array_ptr = (pesapi_create_arrayType)func_array[10]; pesapi_create_object_ptr = (pesapi_create_objectType)func_array[11]; pesapi_create_function_ptr = (pesapi_create_functionType)func_array[12]; - pesapi_get_value_bool_ptr = (pesapi_get_value_boolType)func_array[13]; - pesapi_get_value_int32_ptr = (pesapi_get_value_int32Type)func_array[14]; - pesapi_get_value_uint32_ptr = (pesapi_get_value_uint32Type)func_array[15]; - pesapi_get_value_int64_ptr = (pesapi_get_value_int64Type)func_array[16]; - pesapi_get_value_uint64_ptr = (pesapi_get_value_uint64Type)func_array[17]; - pesapi_get_value_double_ptr = (pesapi_get_value_doubleType)func_array[18]; - pesapi_get_value_string_utf8_ptr = (pesapi_get_value_string_utf8Type)func_array[19]; - pesapi_get_value_binary_ptr = (pesapi_get_value_binaryType)func_array[20]; - pesapi_get_array_length_ptr = (pesapi_get_array_lengthType)func_array[21]; - pesapi_is_null_ptr = (pesapi_is_nullType)func_array[22]; - pesapi_is_undefined_ptr = (pesapi_is_undefinedType)func_array[23]; - pesapi_is_boolean_ptr = (pesapi_is_booleanType)func_array[24]; - pesapi_is_int32_ptr = (pesapi_is_int32Type)func_array[25]; - pesapi_is_uint32_ptr = (pesapi_is_uint32Type)func_array[26]; - pesapi_is_int64_ptr = (pesapi_is_int64Type)func_array[27]; - pesapi_is_uint64_ptr = (pesapi_is_uint64Type)func_array[28]; - pesapi_is_double_ptr = (pesapi_is_doubleType)func_array[29]; - pesapi_is_string_ptr = (pesapi_is_stringType)func_array[30]; - pesapi_is_object_ptr = (pesapi_is_objectType)func_array[31]; - pesapi_is_function_ptr = (pesapi_is_functionType)func_array[32]; - pesapi_is_binary_ptr = (pesapi_is_binaryType)func_array[33]; - pesapi_is_array_ptr = (pesapi_is_arrayType)func_array[34]; - pesapi_native_object_to_value_ptr = (pesapi_native_object_to_valueType)func_array[35]; - pesapi_get_native_object_ptr_ptr = (pesapi_get_native_object_ptrType)func_array[36]; - pesapi_get_native_object_typeid_ptr = (pesapi_get_native_object_typeidType)func_array[37]; - pesapi_is_instance_of_ptr = (pesapi_is_instance_ofType)func_array[38]; - pesapi_boxing_ptr = (pesapi_boxingType)func_array[39]; - pesapi_unboxing_ptr = (pesapi_unboxingType)func_array[40]; - pesapi_update_boxed_value_ptr = (pesapi_update_boxed_valueType)func_array[41]; - pesapi_is_boxed_value_ptr = (pesapi_is_boxed_valueType)func_array[42]; - pesapi_get_args_len_ptr = (pesapi_get_args_lenType)func_array[43]; - pesapi_get_arg_ptr = (pesapi_get_argType)func_array[44]; - pesapi_get_env_ptr = (pesapi_get_envType)func_array[45]; - pesapi_get_this_ptr = (pesapi_get_thisType)func_array[46]; - pesapi_get_holder_ptr = (pesapi_get_holderType)func_array[47]; - pesapi_get_userdata_ptr = (pesapi_get_userdataType)func_array[48]; - pesapi_get_class_data_in_constructor_ptr = (pesapi_get_class_data_in_constructorType)func_array[49]; - pesapi_add_return_ptr = (pesapi_add_returnType)func_array[50]; - pesapi_throw_by_string_ptr = (pesapi_throw_by_stringType)func_array[51]; - pesapi_create_env_ref_ptr = (pesapi_create_env_refType)func_array[52]; - pesapi_env_ref_is_valid_ptr = (pesapi_env_ref_is_validType)func_array[53]; - pesapi_get_env_from_ref_ptr = (pesapi_get_env_from_refType)func_array[54]; - pesapi_duplicate_env_ref_ptr = (pesapi_duplicate_env_refType)func_array[55]; - pesapi_release_env_ref_ptr = (pesapi_release_env_refType)func_array[56]; - pesapi_open_scope_ptr = (pesapi_open_scopeType)func_array[57]; - pesapi_has_caught_ptr = (pesapi_has_caughtType)func_array[58]; - pesapi_get_exception_as_string_ptr = (pesapi_get_exception_as_stringType)func_array[59]; - pesapi_close_scope_ptr = (pesapi_close_scopeType)func_array[60]; - pesapi_create_value_ref_ptr = (pesapi_create_value_refType)func_array[61]; - pesapi_duplicate_value_ref_ptr = (pesapi_duplicate_value_refType)func_array[62]; - pesapi_release_value_ref_ptr = (pesapi_release_value_refType)func_array[63]; - pesapi_get_value_from_ref_ptr = (pesapi_get_value_from_refType)func_array[64]; - pesapi_set_ref_weak_ptr = (pesapi_set_ref_weakType)func_array[65]; - pesapi_set_owner_ptr = (pesapi_set_ownerType)func_array[66]; - pesapi_get_ref_associated_env_ptr = (pesapi_get_ref_associated_envType)func_array[67]; - pesapi_get_ref_internal_fields_ptr = (pesapi_get_ref_internal_fieldsType)func_array[68]; - pesapi_get_property_ptr = (pesapi_get_propertyType)func_array[69]; - pesapi_set_property_ptr = (pesapi_set_propertyType)func_array[70]; - pesapi_get_private_ptr = (pesapi_get_privateType)func_array[71]; - pesapi_set_private_ptr = (pesapi_set_privateType)func_array[72]; - pesapi_get_property_uint32_ptr = (pesapi_get_property_uint32Type)func_array[73]; - pesapi_set_property_uint32_ptr = (pesapi_set_property_uint32Type)func_array[74]; - pesapi_call_function_ptr = (pesapi_call_functionType)func_array[75]; - pesapi_eval_ptr = (pesapi_evalType)func_array[76]; - pesapi_global_ptr = (pesapi_globalType)func_array[77]; - pesapi_get_env_private_ptr = (pesapi_get_env_privateType)func_array[78]; - pesapi_set_env_private_ptr = (pesapi_set_env_privateType)func_array[79]; - pesapi_alloc_type_infos_ptr = (pesapi_alloc_type_infosType)func_array[80]; - pesapi_set_type_info_ptr = (pesapi_set_type_infoType)func_array[81]; - pesapi_create_signature_info_ptr = (pesapi_create_signature_infoType)func_array[82]; - pesapi_alloc_property_descriptors_ptr = (pesapi_alloc_property_descriptorsType)func_array[83]; - pesapi_set_method_info_ptr = (pesapi_set_method_infoType)func_array[84]; - pesapi_set_property_info_ptr = (pesapi_set_property_infoType)func_array[85]; - pesapi_define_class_ptr = (pesapi_define_classType)func_array[86]; - pesapi_find_class_data_ptr = (pesapi_find_class_dataType)func_array[87]; - pesapi_on_class_not_found_ptr = (pesapi_on_class_not_foundType)func_array[88]; - pesapi_class_type_info_ptr = (pesapi_class_type_infoType)func_array[89]; - pesapi_find_type_id_ptr = (pesapi_find_type_idType)func_array[90]; + pesapi_create_class_ptr = (pesapi_create_classType)func_array[13]; + pesapi_get_value_bool_ptr = (pesapi_get_value_boolType)func_array[14]; + pesapi_get_value_int32_ptr = (pesapi_get_value_int32Type)func_array[15]; + pesapi_get_value_uint32_ptr = (pesapi_get_value_uint32Type)func_array[16]; + pesapi_get_value_int64_ptr = (pesapi_get_value_int64Type)func_array[17]; + pesapi_get_value_uint64_ptr = (pesapi_get_value_uint64Type)func_array[18]; + pesapi_get_value_double_ptr = (pesapi_get_value_doubleType)func_array[19]; + pesapi_get_value_string_utf8_ptr = (pesapi_get_value_string_utf8Type)func_array[20]; + pesapi_get_value_binary_ptr = (pesapi_get_value_binaryType)func_array[21]; + pesapi_get_array_length_ptr = (pesapi_get_array_lengthType)func_array[22]; + pesapi_is_null_ptr = (pesapi_is_nullType)func_array[23]; + pesapi_is_undefined_ptr = (pesapi_is_undefinedType)func_array[24]; + pesapi_is_boolean_ptr = (pesapi_is_booleanType)func_array[25]; + pesapi_is_int32_ptr = (pesapi_is_int32Type)func_array[26]; + pesapi_is_uint32_ptr = (pesapi_is_uint32Type)func_array[27]; + pesapi_is_int64_ptr = (pesapi_is_int64Type)func_array[28]; + pesapi_is_uint64_ptr = (pesapi_is_uint64Type)func_array[29]; + pesapi_is_double_ptr = (pesapi_is_doubleType)func_array[30]; + pesapi_is_string_ptr = (pesapi_is_stringType)func_array[31]; + pesapi_is_object_ptr = (pesapi_is_objectType)func_array[32]; + pesapi_is_function_ptr = (pesapi_is_functionType)func_array[33]; + pesapi_is_binary_ptr = (pesapi_is_binaryType)func_array[34]; + pesapi_is_array_ptr = (pesapi_is_arrayType)func_array[35]; + pesapi_native_object_to_value_ptr = (pesapi_native_object_to_valueType)func_array[36]; + pesapi_get_native_object_ptr_ptr = (pesapi_get_native_object_ptrType)func_array[37]; + pesapi_get_native_object_typeid_ptr = (pesapi_get_native_object_typeidType)func_array[38]; + pesapi_is_instance_of_ptr = (pesapi_is_instance_ofType)func_array[39]; + pesapi_boxing_ptr = (pesapi_boxingType)func_array[40]; + pesapi_unboxing_ptr = (pesapi_unboxingType)func_array[41]; + pesapi_update_boxed_value_ptr = (pesapi_update_boxed_valueType)func_array[42]; + pesapi_is_boxed_value_ptr = (pesapi_is_boxed_valueType)func_array[43]; + pesapi_get_args_len_ptr = (pesapi_get_args_lenType)func_array[44]; + pesapi_get_arg_ptr = (pesapi_get_argType)func_array[45]; + pesapi_get_env_ptr = (pesapi_get_envType)func_array[46]; + pesapi_get_this_ptr = (pesapi_get_thisType)func_array[47]; + pesapi_get_holder_ptr = (pesapi_get_holderType)func_array[48]; + pesapi_get_userdata_ptr = (pesapi_get_userdataType)func_array[49]; + pesapi_get_class_data_in_constructor_ptr = (pesapi_get_class_data_in_constructorType)func_array[50]; + pesapi_add_return_ptr = (pesapi_add_returnType)func_array[51]; + pesapi_throw_by_string_ptr = (pesapi_throw_by_stringType)func_array[52]; + pesapi_create_env_ref_ptr = (pesapi_create_env_refType)func_array[53]; + pesapi_env_ref_is_valid_ptr = (pesapi_env_ref_is_validType)func_array[54]; + pesapi_get_env_from_ref_ptr = (pesapi_get_env_from_refType)func_array[55]; + pesapi_duplicate_env_ref_ptr = (pesapi_duplicate_env_refType)func_array[56]; + pesapi_release_env_ref_ptr = (pesapi_release_env_refType)func_array[57]; + pesapi_open_scope_ptr = (pesapi_open_scopeType)func_array[58]; + pesapi_has_caught_ptr = (pesapi_has_caughtType)func_array[59]; + pesapi_get_exception_as_string_ptr = (pesapi_get_exception_as_stringType)func_array[60]; + pesapi_close_scope_ptr = (pesapi_close_scopeType)func_array[61]; + pesapi_create_value_ref_ptr = (pesapi_create_value_refType)func_array[62]; + pesapi_duplicate_value_ref_ptr = (pesapi_duplicate_value_refType)func_array[63]; + pesapi_release_value_ref_ptr = (pesapi_release_value_refType)func_array[64]; + pesapi_get_value_from_ref_ptr = (pesapi_get_value_from_refType)func_array[65]; + pesapi_set_ref_weak_ptr = (pesapi_set_ref_weakType)func_array[66]; + pesapi_set_owner_ptr = (pesapi_set_ownerType)func_array[67]; + pesapi_get_ref_associated_env_ptr = (pesapi_get_ref_associated_envType)func_array[68]; + pesapi_get_ref_internal_fields_ptr = (pesapi_get_ref_internal_fieldsType)func_array[69]; + pesapi_get_property_ptr = (pesapi_get_propertyType)func_array[70]; + pesapi_set_property_ptr = (pesapi_set_propertyType)func_array[71]; + pesapi_get_private_ptr = (pesapi_get_privateType)func_array[72]; + pesapi_set_private_ptr = (pesapi_set_privateType)func_array[73]; + pesapi_get_property_uint32_ptr = (pesapi_get_property_uint32Type)func_array[74]; + pesapi_set_property_uint32_ptr = (pesapi_set_property_uint32Type)func_array[75]; + pesapi_call_function_ptr = (pesapi_call_functionType)func_array[76]; + pesapi_eval_ptr = (pesapi_evalType)func_array[77]; + pesapi_global_ptr = (pesapi_globalType)func_array[78]; + pesapi_get_env_private_ptr = (pesapi_get_env_privateType)func_array[79]; + pesapi_set_env_private_ptr = (pesapi_set_env_privateType)func_array[80]; + pesapi_alloc_type_infos_ptr = (pesapi_alloc_type_infosType)func_array[81]; + pesapi_set_type_info_ptr = (pesapi_set_type_infoType)func_array[82]; + pesapi_create_signature_info_ptr = (pesapi_create_signature_infoType)func_array[83]; + pesapi_alloc_property_descriptors_ptr = (pesapi_alloc_property_descriptorsType)func_array[84]; + pesapi_set_method_info_ptr = (pesapi_set_method_infoType)func_array[85]; + pesapi_set_property_info_ptr = (pesapi_set_property_infoType)func_array[86]; + pesapi_define_class_ptr = (pesapi_define_classType)func_array[87]; + pesapi_find_class_data_ptr = (pesapi_find_class_dataType)func_array[88]; + pesapi_on_class_not_found_ptr = (pesapi_on_class_not_foundType)func_array[89]; + pesapi_class_type_info_ptr = (pesapi_class_type_infoType)func_array[90]; + pesapi_find_type_id_ptr = (pesapi_find_type_idType)func_array[91]; #endif } diff --git a/unity/native_src_il2cpp/Inc/CppObjectMapper.h b/unity/native_src_il2cpp/Inc/CppObjectMapper.h index 5e32ba9c7e..9bdad7e87f 100644 --- a/unity/native_src_il2cpp/Inc/CppObjectMapper.h +++ b/unity/native_src_il2cpp/Inc/CppObjectMapper.h @@ -30,7 +30,7 @@ class FCppObjectMapper final : public ICppObjectMapper v8::Local LoadTypeByString(v8::Isolate* Isolate, v8::Local Context, std::string TypeName); - v8::Local LoadTypeById(v8::Isolate* Isolate, v8::Local Context, const void* TypeId); + virtual v8::MaybeLocal LoadTypeById(v8::Local Context, const void* TypeId) override; void LoadCppType(const v8::FunctionCallbackInfo& Info); diff --git a/unity/native_src_il2cpp/Inc/ObjectMapper.h b/unity/native_src_il2cpp/Inc/ObjectMapper.h index 5d39347dde..69b0185842 100644 --- a/unity/native_src_il2cpp/Inc/ObjectMapper.h +++ b/unity/native_src_il2cpp/Inc/ObjectMapper.h @@ -44,6 +44,8 @@ class ICppObjectMapper virtual void SetPrivateData(v8::Local Context, v8::Local JSObject, void* Ptr) = 0; + virtual v8::MaybeLocal LoadTypeById(v8::Local Context, const void* TypeId) = 0; + virtual std::weak_ptr GetJsEnvLifeCycleTracker() = 0; virtual ~ICppObjectMapper() diff --git a/unity/native_src_il2cpp/Inc/pesapi.h b/unity/native_src_il2cpp/Inc/pesapi.h index e0dcae13f5..66fbcc76b5 100644 --- a/unity/native_src_il2cpp/Inc/pesapi.h +++ b/unity/native_src_il2cpp/Inc/pesapi.h @@ -144,6 +144,7 @@ PESAPI_EXTERN pesapi_value pesapi_create_binary(pesapi_env env, void* str, size_ PESAPI_EXTERN pesapi_value pesapi_create_array(pesapi_env env); PESAPI_EXTERN pesapi_value pesapi_create_object(pesapi_env env); PESAPI_EXTERN pesapi_value pesapi_create_function(pesapi_env env, pesapi_callback native_impl, void* data); +PESAPI_EXTERN pesapi_value pesapi_create_class(pesapi_env env, const void* type_id); PESAPI_EXTERN bool pesapi_get_value_bool(pesapi_env env, pesapi_value value); PESAPI_EXTERN int32_t pesapi_get_value_int32(pesapi_env env, pesapi_value value); diff --git a/unity/native_src_il2cpp/Src/CppObjectMapper.cpp b/unity/native_src_il2cpp/Src/CppObjectMapper.cpp index 07947d0f9b..bb3d0ec49e 100644 --- a/unity/native_src_il2cpp/Src/CppObjectMapper.cpp +++ b/unity/native_src_il2cpp/Src/CppObjectMapper.cpp @@ -37,17 +37,10 @@ v8::Local FCppObjectMapper::LoadTypeByString(v8::Isolate* Isolate, } -v8::Local FCppObjectMapper::LoadTypeById(v8::Isolate* Isolate, v8::Local Context, const void* TypeId) +v8::MaybeLocal FCppObjectMapper::LoadTypeById(v8::Local Context, const void* TypeId) { - auto Template = GetTemplateOfClass(Isolate, TypeId); - if (!Template.IsEmpty()) - { - return Template->GetFunction(Context).ToLocalChecked(); - } - else - { - return v8::Local(); - } + auto Template = GetTemplateOfClass(Context->GetIsolate(), TypeId); + return Template->GetFunction(Context); } void FCppObjectMapper::LoadCppType(const v8::FunctionCallbackInfo& Info) diff --git a/unity/native_src_il2cpp/Src/PesapiAddonLoad.cpp b/unity/native_src_il2cpp/Src/PesapiAddonLoad.cpp index 78ba637e9f..353ae4fdfd 100644 --- a/unity/native_src_il2cpp/Src/PesapiAddonLoad.cpp +++ b/unity/native_src_il2cpp/Src/PesapiAddonLoad.cpp @@ -40,8 +40,8 @@ static pesapi_func_ptr funcs[] = {(pesapi_func_ptr) &pesapi_create_null, (pesapi (pesapi_func_ptr) &pesapi_create_boolean, (pesapi_func_ptr) &pesapi_create_int32, (pesapi_func_ptr) &pesapi_create_uint32, (pesapi_func_ptr) &pesapi_create_int64, (pesapi_func_ptr) &pesapi_create_uint64, (pesapi_func_ptr) &pesapi_create_double, (pesapi_func_ptr) &pesapi_create_string_utf8, (pesapi_func_ptr) &pesapi_create_binary, (pesapi_func_ptr) &pesapi_create_array, - (pesapi_func_ptr) &pesapi_create_object, (pesapi_func_ptr) &pesapi_create_function, (pesapi_func_ptr) &pesapi_get_value_bool, - (pesapi_func_ptr) &pesapi_get_value_int32, (pesapi_func_ptr) &pesapi_get_value_uint32, + (pesapi_func_ptr) &pesapi_create_object, (pesapi_func_ptr) &pesapi_create_function, (pesapi_func_ptr) &pesapi_create_class, + (pesapi_func_ptr) &pesapi_get_value_bool, (pesapi_func_ptr) &pesapi_get_value_int32, (pesapi_func_ptr) &pesapi_get_value_uint32, (pesapi_func_ptr) &pesapi_get_value_int64, (pesapi_func_ptr) &pesapi_get_value_uint64, (pesapi_func_ptr) &pesapi_get_value_double, (pesapi_func_ptr) &pesapi_get_value_string_utf8, (pesapi_func_ptr) &pesapi_get_value_binary, (pesapi_func_ptr) &pesapi_get_array_length, (pesapi_func_ptr) &pesapi_is_null, diff --git a/unity/native_src_il2cpp/Src/PesapiV8Impl.cpp b/unity/native_src_il2cpp/Src/PesapiV8Impl.cpp index 1bbd888435..de9872e892 100644 --- a/unity/native_src_il2cpp/Src/PesapiV8Impl.cpp +++ b/unity/native_src_il2cpp/Src/PesapiV8Impl.cpp @@ -186,6 +186,15 @@ pesapi_value pesapi_create_function(pesapi_env env, pesapi_callback native_impl, } MSVC_PRAGMA(warning(pop)) +pesapi_value pesapi_create_class(pesapi_env env, const void* type_id) +{ + auto context = v8impl::V8LocalContextFromPesapiEnv(env); + auto cls = puerts::DataTransfer::IsolateData(context->GetIsolate())->LoadTypeById(context, type_id); + if (cls.IsEmpty()) + return nullptr; + return v8impl::PesapiValueFromV8LocalValue(cls.ToLocalChecked()); +} + bool pesapi_get_value_bool(pesapi_env env, pesapi_value pvalue) { auto context = v8impl::V8LocalContextFromPesapiEnv(env); diff --git a/unity/native_src_il2cpp/Src/Puerts.cpp b/unity/native_src_il2cpp/Src/Puerts.cpp index 734f58c9da..fa7570a175 100644 --- a/unity/native_src_il2cpp/Src/Puerts.cpp +++ b/unity/native_src_il2cpp/Src/Puerts.cpp @@ -140,11 +140,11 @@ struct JSEnv return; } - auto Ret = pom->LoadTypeById(Isolate, Context, type); + auto Ret = pom->LoadTypeById(Context, type); if (!Ret.IsEmpty()) { - Info.GetReturnValue().Set(Ret); + Info.GetReturnValue().Set(Ret.ToLocalChecked()); } }, v8::External::New(Isolate, &CppObjectMapper))->GetFunction(Context).ToLocalChecked()).Check();