dev-ui-performance

Optimizes Unity uGUI Canvas layouts, draw call batching, and raycast overhead for mobile UI performance.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/Unity-UPM-Packages/Antigravity-skills --skill dev-ui-performance-unity-upm-packages
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dev-ui-performance
Source: https://github.com/Unity-UPM-Packages/Antigravity-skills/tree/main/.agents/skills/dev-ui-performance
Command: npx skills add https://github.com/Unity-UPM-Packages/Antigravity-skills --skill dev-ui-performance-unity-upm-packages

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unity uGUI interfaces often suffer from excessive Canvas rebuilds, broken draw call batching, and unnecessary raycast overhead, causing frame drops and poor performance on mobile devices. ## Core Features & Use Cases - Canvas Partitioning Strategy: Separates dynamic HUD elements from static backgrounds so frequent updates do not force full Canvas geometry rebuilds. - Batching & Raycast Optimization: Enforces Sprite Atlas usage and disables raycastTarget on non-interactive Images and Text to reduce draw calls and touch event cost. - ScrollRect & Layout Optimization: Provides object pooling patterns for ScrollRect lists and rules for LayoutGroup, Mask, and TextMeshPro usage. - Use Case: When a mobile game's HUD with health bars and timers causes frame spikes, apply this Skill to isolate dynamic elements onto their own Canvas, pool inventory list cells, and audit the screen against the included performance checklist. ## Quick Start Audit my Unity UI screen for performance issues and fix Canvas rebuild, raycast, and ScrollRect pooling problems.

Frequently Asked Questions about dev-ui-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce Canvas rebuilds in Unity uGUI?▼

Canvas rebuilds are reduced by partitioning dynamic elements onto their own Canvas or child Canvas. Any element updating more than once per second, such as health bars or timers, must be isolated so static elements are not rebuilt every frame.

How to reduce draw calls in Unity UI?▼

Draw calls are reduced by packing all UI sprites into Sprite Atlases grouped by usage context, such as Atlas_HUD or Atlas_MainMenu. Never mix atlas sprites with single-texture sprites on the same Canvas, since crossing texture boundaries breaks batching.

Should I use Mask or RectMask2D in Unity?▼

Use RectMask2D for rectangular crops like scroll viewports because it avoids stencil buffer writes and is GPU-cheaper. Reserve Mask with an Image only for non-rectangular or circular clipping where the stencil cost is justified.

Why does my Unity ScrollRect lag on mobile?▼

ScrollRect lag happens when all list items are instantiated at once instead of being pooled. Use an object pooling pattern that reuses pre-allocated cells and binds data without instantiating, which is mandatory for lists exceeding 10 items.

Does raycastTarget affect Unity UI performance?▼

Yes, every Image and Text with raycastTarget enabled is iterated during touch events, including decorative elements. Disable raycastTarget on backgrounds, decorative icons, read-only labels, and progress bar fills, keeping it only on Buttons, Toggles, Sliders, and InputFields.

How do I avoid string allocations with TextMeshPro?▼

Avoid string allocations by using the TMP SetText overload with format parameters, such as SetText("Score: {0}", score), instead of interpolated strings. Also disable word wrapping on fixed-length HUD text to skip reflow calculations.