TL;DR: Unity as a Library lets you run a Unity scene inside an existing iOS, Android or React Native app instead of shipping Unity as the whole app. It is worth it when one feature genuinely needs real-time 3D, AR or physics and the rest of the product is ordinary screens: accounts, payments, lists, settings. The cost is real: one Unity runtime per process that you cannot fully restart, tens of megabytes of extra app size, more memory, two toolchains in every build, and a message bridge you now own. My rule is to keep Unity as a guest. The host app owns navigation, auth, payments and data. Unity owns one scene, receives a small versioned message, renders, and reports back. If the 3D part is light, skip Unity entirely and use something native.
A founder with a working React Native app and a 3D idea, an AR preview, a mini game or an interactive visualisation, eventually asks: can we just put the Unity bit inside the app? Unity's official answer is Unity as a Library, and it works. It also has sharp edges nobody mentions in the demo. I have spent more than five years in Unity, much of it on products that are not games at all, and I have worked in stacks where Unity sits next to React Native and native code. At RAQTS, where I stepped in as CTO, the Unity Lumo layer and the React Native apps were separate clients over one shared backend. Deciding where Unity should live, and where it should not, is a recurring architecture call, so here is how I make it.
What Unity as a Library actually is
Normally a Unity build is the app. Unity generates the Xcode or Gradle project, owns the entry point, and every screen is a Unity scene.
With Unity as a Library, Unity exports itself as a component that a separate host app loads:
- On Android, the export contains a
unityLibraryGradle module. Your host app includes that module and starts Unity's player activity when the user opens the 3D feature. - On iOS, the exported Xcode project contains a
UnityFrameworktarget. The host app loads that framework at runtime and asks it to start rendering, with the game data bundled inside the framework. - In React Native or Flutter, community wrapper packages sit on top of those two native integrations and expose Unity as a view component. Underneath, it is still the Android module and the iOS framework.
Communication goes both ways. Native code can call a method on a named GameObject with a string payload. Unity calls back out through a small native plugin, the same pattern I described in Unity native plugins for iOS and Android.
When it is worth it
I reach for Unity as a Library when all of these are true:
- One feature needs what Unity is good at. Real-time 3D with interaction, AR through AR Foundation, physics, or an existing Unity scene the team has already built and tested.
- The rest of the app is ordinary. Lists, forms, auth, payments, settings, push. This is where React Native or native code is simply better and cheaper to build.
- Users move between the two often enough that sending them to a separate app would break the experience.
- The team can maintain both sides. Someone who knows Unity, and someone who knows the host platform, for as long as the product lives.
Think of an AR "see it in your room" button inside a shopping app: the 3D part is a destination, not the whole journey.
When it is not
Most of the time I talk people out of it, for one of three reasons.
The 3D is light. Spinning a product model, a simple animated scene or an interactive chart does not need a game engine. On iOS, RealityKit and SceneKit handle a lot. On Android and in React Native, lighter 3D renderers, Lottie or Rive cover more than people expect. If the feature is a viewer rather than an experience, use the lighter tool.
The app is mostly Unity. If 80 percent of the time is spent in the 3D experience, wrapping it in a host app adds a second toolchain to save writing a few menus. Build the whole thing in Unity and accept that the settings screen is slightly more work.
AR is the only reason. If the feature is plain plane detection and placing an object, native ARKit and ARCore, or a lighter AR library, may be enough. I wrote about that tradeoff in choosing an AR SDK. Unity earns its place when the AR scene is rich, shared across platforms, or already exists.
The costs nobody puts in the demo
One runtime per process, and you cannot truly restart it
Unity's own documentation is clear on this: only one instance of the Unity runtime can run in a process. You can unload it to free some memory, but after a full quit it cannot be started again until the app restarts. That shapes the whole design. You cannot treat Unity like a normal screen that is created and destroyed. You either keep it alive in the background, paused, or you accept that it stays loaded once the user has opened it.
App size
Even an empty Unity scene adds tens of megabytes to the download, before any of your own models and textures. For an app that was 30 MB, that can double the size. The techniques in reducing Unity mobile app size all apply, and asset streaming through Addressables becomes almost mandatory if the 3D content is large.
Memory and startup
The first Unity start takes a noticeable moment on mid-range Android phones, and the runtime holds memory while it runs, so older devices kill the app in the background more often. I test on the oldest phone in the target market.
Two toolchains in every build
Every release means exporting from Unity, then building the host app around that export, with the Unity, Gradle, Xcode and React Native versions all in agreement. A proper CI pipeline pays for itself here. Upgrades get harder too: upgrading Unity on a live project now has to line up with the host app's own upgrade cycle.
Platform conflicts
Two runtimes in one app will argue about shared things. The ones I check first:
- Audio. On iOS both sides want to configure the audio session. Recording, background audio or a video call in the host app can conflict with Unity's audio settings.
- Orientation. The host app may be portrait only while the Unity scene wants landscape.
- The Android back button. Decide who handles it, or users get stuck inside the Unity view.
- Status bar and safe areas. Unity and the host app may disagree about what is fullscreen.
- Camera permission. For AR, ask in the host app with a proper explanation, before Unity tries to open the camera. App Store reviewers care about that wording, as I covered in App Store review rejections.
How I structure the integration
The pattern that has held up best for me is simple: Unity is a guest in the host app.
The host owns everything outside the scene
Login, profile, payments, navigation, analytics and data fetching stay in React Native or native code. Unity holds no auth token, never calls the payment API and does not decide where the user goes next. The parts with legal and financial weight stay in one place, and the Unity side can be replaced without touching them.
One small, versioned message in each direction
When the host opens the 3D feature, it sends Unity one message as JSON: a version number, the scene to show, and only the data that scene needs, such as a product ID and the URL of the model to load. Unity sends back events in the same format: loaded, user placed the item, user finished, error with a reason.
Keeping the protocol small and versioned matters because the two sides are built separately. A version field lets either side refuse a message it does not understand rather than crashing, the same idea I use for keeping old mobile app versions working.
Unity loads content, it does not bundle all of it
The Unity build contains the scene logic and a small amount of default content. Models and textures load at runtime from a CDN or Addressables. That keeps the app download smaller and lets the team update 3D content without a store release.
Pause, do not destroy
When the user leaves the 3D feature, the host pauses Unity rather than quitting it, because quitting cannot be undone in the same session. Frame rate drops to nothing, audio stops, and the camera is released. When the user comes back, it resumes in place. If memory pressure becomes a problem on low-end phones, unloading is the next step, with a clear understanding that it only frees part of the memory.
An editor fake for the bridge
Inside the Unity editor, the host app does not exist, so the bridge gets a C# interface with an editor implementation that sends fake host messages. On the host side, a stub screen stands in for Unity during normal development, so React Native engineers are not blocked by a slow Unity export.
A quick decision checklist
Before committing to Unity as a Library, I want a yes to most of these:
- The 3D or AR feature genuinely needs a game engine, not just a model viewer.
- The rest of the app is ordinary screens that are better built natively or in React Native.
- The team can maintain Unity and the host platform for the life of the product.
- The size increase is acceptable for the target market and its data costs.
- The oldest supported phone runs the scene acceptably, tested on a real device.
- CI can build the combined app from a clean checkout on both platforms.
- The message protocol is written down, small and versioned, before either side is built.
If several are a no, use a lighter 3D tool inside the app, or build the whole product in Unity, depending on which side is bigger.
Unity as a Library lets a normal app borrow a game engine for the one screen that needs it. The mistake is treating it as free. Keep the host in charge, Unity as a guest, and a tiny protocol between them, and the two runtimes stay out of each other's way.
I build cross-platform products across Unity, React Native, native mobile and the web, and lead engineering as a fractional CTO for teams with hard technical edges. If you are weighing whether Unity belongs inside your app, more about my background here, or book a call.