- Create bridge in C
- Build as framework
- Unity C# calls into bridge code
- Pass C# delegate to C as function pointer, allows native to call into C# w/o UnitySendMessage
- Hooks from C++ into C# via
Marshal.GetFunctionPointerForDelegate
- Handles to managed types (e.g. GameObject) enables more sophisticated usage
- In a way, Unity/C# becomes implementation of a C++ interface
Native UI Overlay for Unity (Android)
- Create desired UI in a fragment
- Build as library (.aar)
- Include library in Unity as a plugin
Plugin tutorial (Unity Android - part 1)
- Create UI / plugin code in a fragment
- DO NOT extend UnityPlayerActivity because this could interfere with other plugins
- Using singleton pattern can enable C# code to easily get a reference to the plugin