Yesterday, Unity made an update stating that from Unity 2019.3.a2 onwards, Android and iOS developers will be able to incorporate Unity features into their apps and games. Developers will be able to integrate the Unity runtime components and their content ( augmented reality, 3D/2D real-time rendering, 2D mini-games, and more) into a native platform project so as to use Unity as a library.
“We know there are times when developers using native platform technologies (like Android/ Java and iOS/Objective C) want to include features powered by Unity in their apps and games,” said J.C. Cimetiere, senior technical product manager for mobile platforms, in a blog post.
How it works
The mobile app build process overall is still the same. Unity creates the iOS Xcode and Android Gradle projects. However, to enable this feature, Unity team has modified the structure of the generated iOS Xcode and Android Gradle projects as follows:
- A library part – iOS framework and Android Archive (AAR) file – that includes all source files and plugins
- A thin launcher part that includes app representation data and runs the library part
Currently, Unity as a Library supports full-screen rendering only. For now, rendering on only a part of the screen is not supported. Also loading more than one instance of the Unity runtime is not supported. Developers need to adapt third-party plugins (native or managed) for them to work properly.