NNabeel Hassan

Blog · December 4, 2026 · 8 min read

Embedding Unity in a React Native or Native App: When Unity as a Library Is Worth It

By Nabeel Hassan — AI Engineer · ICPC World Finalist

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:

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:

  1. 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.
  2. 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.
  3. Users move between the two often enough that sending them to a separate app would break the experience.
  4. 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:

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:

  1. The 3D or AR feature genuinely needs a game engine, not just a model viewer.
  2. The rest of the app is ordinary screens that are better built natively or in React Native.
  3. The team can maintain Unity and the host platform for the life of the product.
  4. The size increase is acceptable for the target market and its data costs.
  5. The oldest supported phone runs the scene acceptably, tested on a real device.
  6. CI can build the combined app from a clean checkout on both platforms.
  7. 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.

FAQ

What is Unity as a Library?

It is Unity's supported way to run Unity content inside a separate host app instead of shipping Unity as the whole app. On Android the export includes a unityLibrary Gradle module, on iOS a UnityFramework target, and React Native or Flutter wrappers sit on top of those native integrations.

Can you embed Unity in a React Native app?

Yes. Community wrapper packages expose Unity as a React Native view, built on Unity as a Library's Android module and iOS framework. You still need native builds, so it does not work in Expo Go, and every release involves exporting from Unity and then building the React Native app around it.

What are the downsides of Unity as a Library?

Only one Unity runtime can run per process and it cannot be restarted after a full quit, the app grows by tens of megabytes, memory use and first-launch time go up, every build needs two toolchains to agree, and the two runtimes can conflict over audio, orientation, the back button and permissions.

When should you not use Unity inside an app?

When the 3D is light, such as a simple model viewer, a native renderer or animation tool is cheaper. When most of the app is the 3D experience, build the whole thing in Unity. When AR is plain plane detection, native ARKit and ARCore may be enough.

Building something in this space?

I take on AI-agent, automation and product work directly — scoped fast, shipped fast.

Book a discovery call →

Keep reading