提交 4b1f6fcb 编写于 作者: U UnityAlex

Passing detailed reason for image load failure back to the unity editor via callback.

上级 226a8956
......@@ -1345,7 +1345,10 @@ done:
invalid_image:
if (errors) {
MonoVerifyInfo *info = (MonoVerifyInfo *)errors->data;
g_warning ("Could not load image %s due to %s", image->name, info->message);
char* log_message = g_strdup_printf("Could not load image %s due to %s\nRun the peverify utility against this for more information.", image->name, info->message);
if (!mono_unity_log_error_to_editor(log_message))
g_warning (log_message);
g_free(log_message);
mono_free_verify_list (errors);
}
MONO_PROFILER_RAISE (image_failed, (image));
......
......@@ -976,6 +976,23 @@ MONO_API int mono_unity_gc_is_disabled()
#endif
}
// Logging
static UnityLogErrorCallback editorLoggingCallback;
MONO_API void mono_unity_set_editor_logging_callback(UnityLogErrorCallback callback)
{
editorLoggingCallback = callback;
}
gboolean mono_unity_log_error_to_editor(const char *message)
{
if (editorLoggingCallback)
{
editorLoggingCallback(message);
return TRUE;
}
return FALSE;
}
MONO_API void
mono_unity_install_unitytls_interface(unitytls_interface_struct* callbacks)
{
......
......@@ -169,6 +169,10 @@ MONO_API void mono_unity_gc_disable();
// Deprecated. Remove when Unity has switched to mono_unity_gc_set_mode
MONO_API int mono_unity_gc_is_disabled();
// logging
typedef void (*UnityLogErrorCallback) (const char *message);
MONO_API void mono_unity_set_editor_logging_callback(UnityLogErrorCallback callback);
gboolean mono_unity_log_error_to_editor(const char *message);
//misc
MonoAssembly* mono_unity_assembly_get_mscorlib();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册