https://github.com/duzexu/use-unity-as-library
将Unity以库形式集成到原生iOS
https://github.com/duzexu/use-unity-as-library
ios swift unity
Last synced: 11 months ago
JSON representation
将Unity以库形式集成到原生iOS
- Host: GitHub
- URL: https://github.com/duzexu/use-unity-as-library
- Owner: duzexu
- License: other
- Created: 2020-05-21T07:56:56.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-26T08:26:50.000Z (over 4 years ago)
- Last Synced: 2025-04-28T13:34:02.474Z (about 1 year ago)
- Topics: ios, swift, unity
- Language: Objective-C++
- Homepage: https://duzexu.github.io/post/Use_Unity_as_Library/
- Size: 1.72 MB
- Stars: 6
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Unity as a Library integration example to iOS and Android #
In some scenario developers using native platform technologies (like Android/Java & iOS/Objective C) want to include in their apps/games features powered by Unity for 3D/2D Real Time Rendering, AR experience, interaction with 3D models, 2D mini games and more.
Starting with Unity 2019.3.0a2, Unity introduced a new feature to use Unity as a library in native apps by integrating the Unity runtime components and content in a native platform project. The Unity Runtime Library exposes controls to manage when and how to load/activate/unload within the native application.
**Limitations**
While we tested many scenarios for Unity as a library hosted by a native app, Unity does not control anymore the lifecycle of the runtime, so we cannot guarantee it'll work in all possible use cases.
For example:
- Unity as a Library supports rendering only full screen, rendering on a part of the screen isn’t supported.
- Loading more than one instance of the Unity runtime isn’t supported.
- You may need to adapt 3rd party Plug-ins (native or managed) to work properly
- Overhead of having Unity in unloaded state is: 90Mb for Android and 110Mb for iOS
**How it works**
The build process overall is still the same, Unity creates the iOS Xcode and Android Gradle projects and generated iOS Xcode and Android Gradle projects have the following structure:
A library part (iOS framework and Android Archive (AAR) file) that includes all source & plugins
A thin launcher part that includes app representation data and runs library
Step by step explanations on how to include the [iOS](docs/ios.md) / [Android](docs/android.md) library part into your native application when needed.