Unity as a Library - cross platform frameworks

Unity as a library, mixed with a native app sounds great. But you might still want to use a cross-platform framework (like Xamarin.forms, React Native, Flutter) to manage developing on both Android and iOS together, while maintaining a native-like experience for non-Unity sections.

Anyone has experience of mixing one these cross-platform frameworks with Unity, as a library?
Have they been tested with Unity?

You have to write a native plugin for the cross-platform framework you’re using. The native plugin contains the code, for each platform you want to support, that integrates the framework with UaaL. Since the runtime of Unity is different on and native to every platform, there needs to be code to provide a cross-platform interface to the framework.

I’ve written a React Native UaaL plugin for a contract and it doesn’t take too much time. However, you need a lot of specific knowledge to get everything working properly, e.g. how to write native plugins in Unity, how to communicate between C#, C++ and native language of the platform, or how to integrate Unity’s native view and lifecycle into the native side of the framework.

There are open source plugins that do this but AFAIK they’re often out of date. Expect a lot of research and reading source code if you’re not familiar with this.

1 Like