Unity
Gum for Unity draws Gum UI (layout, Forms controls, and .gumj projects) with SkiaSharp. It needs two Unity packages: Gum, and SkiaGameRendering (v0.20.0 or newer), which supplies SkiaSharp.
Quick Start
Install the two packages (see Install the Packages below). Gum requires Unity 6 or newer.
In the Project window, create a C# script (Assets > Create > Scripting > MonoBehaviour Script) named
GumExample, and replace its contents with the script under Full Script below. It is the whole setup: it creates theGumGameObject withGumRendererandGumInput, so you don't add anything to your scene.Press Play. A button labeled "Click me" appears in the Game view.
GumRenderer sets up Gum in Awake, so your own code can create UI from Start or later. Gum updates and draws itself, so the script has no Update or Draw.
Install the Packages
Open Window > Package Manager.
Click the + button, then Install package from git URL.
Paste this URL and click Install:
https://github.com/vchelaru/SkiaGameRendering.git#upmRepeat with this URL:
https://github.com/vchelaru/Gum.git#upm
You can also add both lines to Packages/manifest.json instead:
"com.vchelaru.skiagamerendering": "https://github.com/vchelaru/SkiaGameRendering.git#upm",
"com.vchelaru.gum": "https://github.com/vchelaru/Gum.git#upm"The #upm at the end of each URL tells Unity to use the ready-to-install copy of the package that Gum publishes with each release. It always points at the newest one. Unity does not update on its own, so to upgrade, reinstall the package or use the update button in Package Manager.
To stay on a specific Gum version, end the Gum URL with #upm/v<version> instead, for example #upm/v2026.10.2-preview.2.2. Each version is listed under Gum's tags on GitHub as upm/v<version>.
What the Components Do
GumRenderersets up Gum and draws the UI over the screen.GumInputpasses Unity's mouse, touch, keyboard, and gamepad input to Gum each frame. It belongs on the same GameObject asGumRenderer.
Input
The Input System package is optional. If your project uses it and Edit > Project Settings > Player > Active Input Handling is Input System Package (New) or Both, GumInput reads it for the mouse, touch, keyboard, and gamepads. If Active Input Handling is Input Manager (Old), GumInput reads Unity's legacy Input class for the mouse, touch, and keyboard. Gamepads are not available with the legacy Input Manager.
Mouse and touch work right away. To move between Forms controls with the keyboard or a gamepad, call GumUI.UseKeyboardDefaults() or GumUI.UseGamepadDefaults() in your script.
Using the Code Samples in These Docs
Most code samples on other pages are written for a Game class. In Unity, adapt them like this:
Code under a
// Initializecomment goes in your script'sStartmethod.Code under a
// Updatecomment goes in your script'sUpdatemethod. Skip anyGumUI.Updatecall, sinceGumRendereralready updates Gum.Skip any
GumUI.Drawcall, sinceGumRendereralready draws Gum.Add
GumService GumUI => GumService.Default;to your script, as in Full Script.
Samples that use MonoGame types such as GameTime, GraphicsDevice, or Microsoft.Xna.Framework.Color do not apply to Unity.
Loading a Gum Project
Copy your Gum project folder into
Assets/StreamingAssets.Set
GumRenderer.ProjectFileto the.gumjpath inside that folder, for exampleGumProject/GumProject.gumj.
If you add the components from code, add them to an inactive GameObject, set ProjectFile, then activate the GameObject.
Rendering
Gum draws on the GPU through SkiaGameRendering on every graphics API it supports, including Direct3D 11 and Metal. On any other API, such as WebGL, GumRenderer logs an error and disables itself; there is no CPU fallback. GumRenderer.Texture holds the result. Turn off GumRenderer.DrawToScreen to display the texture yourself.
IL2CPP
If you build with IL2CPP, add an Assets/link.xml file that keeps netstandard:
Generated Code in an Assembly With No Engine References
Code generated by the Gum tool registers its types at startup. In Unity it does this with Unity's RuntimeInitializeOnLoadMethod attribute, which lives in UnityEngine. An assembly definition with No Engine References checked cannot see UnityEngine, so that attribute does not compile there.
To use generated code in such an assembly, define GUM_NO_UNITY_ENGINE in Edit > Project Settings > Player > Scripting Define Symbols. The generated code then uses [System.Runtime.CompilerServices.ModuleInitializer] instead of the Unity attribute.
Unity does not run [ModuleInitializer] methods, so call the registration yourself at startup, before you create any generated screen or component:
Each generated element's
RegisterRuntimeType()method.StandardElementsCodeGenRegistration.RegisterFallbackStandardElements(), which the tool generates into your project's root namespace. It isinternal, so call it from the same assembly. Without it, standard element states and categories assigned by generated code silently do nothing.
Full Script
Last updated
Was this helpful?

