您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
22 行
653 B
22 行
653 B
using UnityEngine;
|
|
using AOT;
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
using NativeBindings = Unity.UIWidgets.ui.NativeBindings;
|
|
|
|
public static class NativeConsole {
|
|
internal delegate void LogDelegate(IntPtr message, int iSize);
|
|
|
|
[DllImport(NativeBindings.dllName)]
|
|
internal static extern void InitNativeConsoleDelegate(LogDelegate log);
|
|
|
|
[MonoPInvokeCallback(typeof(LogDelegate))]
|
|
internal static void LogMessageFromCpp(IntPtr message, int iSize) {
|
|
Debug.Log(Marshal.PtrToStringAnsi(message, iSize));
|
|
}
|
|
|
|
public static void OnEnable()
|
|
{
|
|
InitNativeConsoleDelegate(LogMessageFromCpp);
|
|
}
|
|
}
|