如何使用mono实现类似内部调用的Unity

ada*_*mer 4 mono unity-game-engine

C#侧码

[WrapperlessIcall]

[MethodImpl(MethodImplOptions.InternalCall)]

private extern void INTERNAL_set_rotation(ref Quaternion value);
Run Code Online (Sandbox Code Playgroud)

如何将此方法从C++公开为单声道

谢谢.

Rol*_*nge 8

你需要打电话mono_add_internal_call:

mono_add_internal_call ("YourClass::INTERNAL_set_rotation", yourclass_INTERNAL_set_rotation);
Run Code Online (Sandbox Code Playgroud)

这里有一些文档:http://www.mono-project.com/Embedding_Mono#Exposing_C_code_to_the_CIL_universe

这是一个代码示例:https://github.com/mono/moon/blob/8d8ece884382d653d215b0da5bf633079566d816/src/deployment.cpp#L579