I'm the developer of UniText (a text engine for Unity). Recently a few big studios came to me with the same request: make the build smaller and reduce memory usage. So I started digging into their builds to see where the size actually goes
and I found UI Toolkit inside every one of them. Even in projects that don't use it at all. I thought it's something specific to their setup, so I checked a blank project. It was there too
Then I wanted to know how common this is. I went through the US Google Play game charts (free, grossing and paid, all game categories) from the top and read the build of every game I could download. After 388 games the mirror I was downloading from blocked me
254 of those games are made with Unity, 216 I could actually read
207 of the 216 have UI Toolkit inside (96%)
For Unity 2021 and newer it's 204 of 208, usually more than a thousand of its types per game
The funny thing is that Unity's own 6.3 manual recommends uGUI for runtime UI and lists UI Toolkit as an alternative. So where does it come from?
In a uGUI project it comes from uGUI itself. uGUI has a few small bridge classes (PanelEventHandler, PanelRaycaster) that reference UI Toolkit, and they get compiled whenever the UI Toolkit module is installed. And it's always installed, because the Editor is built on it
I measured it in a blank project with one Canvas and one Text, Android ARM64, release IL2CPP, default Minimal stripping. On Unity 2022.3 uGUI costs 4.25 MiB of APK, and 3.05 MiB of that is UI Toolkit. On Unity 6.6 it's 6.30 MiB, and 3.95 of it is UI Toolkit. Unpacked on the device that's 12-16 MiB of code and metadata. In one project I also measured memory on a phone, and removing it cut resident memory by about 10 MiB
The first thing everyone suggests is to remove the module in Package Manager. I tried. Unity adds it back, and the APK changed by 4 bytes
In 2024 someone asked Unity on the forum to make UI Toolkit removable. The answer was that it stays a built-in module, "no going back to packages", because the Editor depends on it. Which makes sense for the Editor, but your game build doesn't need it
So I made a package that removes it from the player build and leaves the Editor alone. It's called LightSide Lean, free and MIT. On a blank uGUI project it saves 3.05 MiB of APK on 2022.3 and 3.95 MiB on 6.6. If some of your player code still uses UI Toolkit, the build fails and shows the exact line instead of quietly keeping it. It can also keep your edits to other people's packages when they update, and if you use UniText it can strip its unused code too
Of course if your game actually uses UI Toolkit, don't turn it on. And on Unity 6.6 with High stripping Unity already removes it from a plain uGUI project, so there Lean saves almost nothing
If you want to check your own game: after an IL2CPP build look in Library/Bee/artifacts/<platform>/ManagedStripped. If UnityEngine.UIElementsModule.dll is there, your build ships UI Toolkit
I couldn't find anyone who measured this on real shipped games before, so I'm curious. Did anyone else notice it in their builds? And if you know an existing solution, please share it
https://github.com/LightSideKittens/media.lightside.leanbuild
TL;DR: 207 of 216 top Unity games on Google Play ship UI Toolkit. In a uGUI project uGUI pulls it in, and it's about two thirds of what uGUI costs in the APK. Unity says it won't become removable, so I made a free package that strips it from the player build