Version: 2022.1
Platform development
Deep linking

Using Unity as a Library in other applications

Unity as a Library is intended for specialist users who use native platform technologies such as Java/Android, Objective C/iOS, or Windows Win32/UWP, and want to include Unity-powered features in their games or applications.

This documentation assumes that you have experience with developing for native platform technologies such as Java/Android, Objective C/iOS, or Windows Win32/UWP, and that you are familiar with the structure of the project, language features and specific platform configuration options (for example, user permissions).

Starting with Unity 2019.3, you can use Unity as a Library in other applications by integrating your content and the Unity runtime components in a native platform project. This enables you to embed content that uses 3D or 2D real-time rendering, like AR experiences, interaction with 3D models, and 2D mini-games. The Unity Runtime Library exposes ways to manage loading, activating, and unloading within the native application.

The following platforms currently support Unity as a Library:

To determine platform versions and other dependencies, see the system requirements page.

Limitations

When hosted by another application, Unity doesn’t control the runtime lifecycle, so it might not work in all scenarios. Known limitations include:

  • On Android and iOS:
    • Only full-screen rendering is supported. It’s not possible to render only on a part of the screen.
    • When Unity is in an unloaded state (after calling Application.Unload), it retains some amount of memory (between 80–180Mb) to be able to instantly switch back and run again in the same process. The amount of memory that’s not released largely depends on the device’s graphics resolution.
  • On iOS, if the Unity runtime quits entirely (after calling Application.Quit), it’s not possible to reload Unity again in the same app session.
  • You can’t load more than one instance of the Unity runtime, or integrate more than one Unity runtime.
  • You might need to adapt your native and managed plug-insA set of code created outside of Unity that creates functionality in Unity. There are two kinds of plug-ins you can use in Unity: Managed plug-ins (managed .NET assemblies created with tools like Visual Studio) and Native plug-ins (platform-specific native code libraries). More info
    See in Glossary
    to work properly.

  • Unity as a Library added in 2019.3.NewIn20193
Platform development
Deep linking
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961