Skip to main content
tutorial

Unity UI Toolkit vs UGUI: 2025 Developer Guide

Angry Shark Studio
12 min read
Unity UI Toolkit UGUI UI Development Performance Tutorial Unity UI Comparison Unity UI Builder

Two UI systems. One game engine. Endless confusion.

Unity maintains both UGUI (released 2014) and UI Toolkit (released 2019). In 2025, developers still struggle to choose. This guide provides clarity through benchmarks, code comparisons, and practical recommendations.

Unity UI Toolkit vs UGUI comparison - GameObject hierarchy versus document-based UI structure side by side

Understanding Unity’s UI Evolution

UGUI replaced the ancient OnGUI system in Unity 4.6. It brought GameObject-based UI with visual editing. UI Toolkit arrived in Unity 2019.1 as “UIElements,” promising web-like development patterns and better performance.

Today, Unity actively develops both systems. Neither is deprecated. Unity’s official position: “Choose the right tool for your project.”

But what does that mean practically?

Quick Comparison Table

FeatureUGUIUI Toolkit
Release Year20142019
ArchitectureGameObject-basedDocument-based
PerformanceGood for simple UIExcellent for complex UI
AnimationFull Animator/TimelineCSS transitions only
Visual EditorScene ViewUI Builder
Learning CurveFamiliar to Unity devsWeb-like patterns
Mobile PerformanceDecentSuperior
Data BindingManualBuilt-in support
Asset Store SupportExtensiveLimited but growing
Best ForGames, animationsApps, data-heavy UI

UGUI: The GameObject-Based System

UGUI builds UI from GameObjects. Every button, text, image exists as a GameObject with components. Familiar to any Unity developer.

UGUI Architecture

// UGUI follows Unity's component pattern
public class MainMenuUI : MonoBehaviour
{
    [SerializeField] private Button playButton;
    [SerializeField] private Button settingsButton;
    [SerializeField] private Text titleText;
    [SerializeField] private Image backgroundImage;
    
    void Start()
    {
        playButton.onClick.AddListener(OnPlayClicked);
        settingsButton.onClick.AddListener(OnSettingsClicked);
        
        // Direct component manipulation
        titleText.text = "Game Title";
        backgroundImage.color = new Color(1f, 1f, 1f, 0.8f);
    }
    
    void OnPlayClicked()
    {
        // Transition with animation
        GetComponent<Animator>().SetTrigger("FadeOut");
        StartCoroutine(LoadGameAfterTransition());
    }
}

Core components:

  • Canvas: Renders UI elements
  • RectTransform: Positions and sizes elements
  • EventSystem: Handles input
  • GraphicRaycaster: Determines what’s clicked

UGUI Strengths

Visual Editing: Design directly in Scene view. Drag elements, adjust anchors, preview immediately. No code compilation for layout changes.

Animation Power: Full Animator support. Create complex UI animations with curves, blend trees, state machines. Timeline integration for cutscenes.

// UGUI animation integration
public class AnimatedPanel : MonoBehaviour
{
    private Animator animator;
    private CanvasGroup canvasGroup;
    
    public void ShowPanel()
    {
        animator.SetBool("IsVisible", true);
        // Animator handles fade, scale, slide animations
    }
    
    public void HidePanel()
    {
        animator.SetBool("IsVisible", false);
        // Smooth transitions between states
    }
}

Mature Ecosystem: Thousands of Asset Store packages. TextMeshPro for advanced text. DOTween for programmatic animations. Proven solutions for every need.

Runtime Flexibility: Instantiate UI dynamically. Modify any property at runtime. Build procedural interfaces easily.

UGUI Limitations

Performance Cost: Every UI element creates a GameObject. Transform hierarchy updates. Batch breaking from transparency. Draw calls multiply quickly. Learn more about Unity performance optimization in our dedicated guide.

Manual Updates: No automatic data binding. Update each element individually:

// UGUI requires manual updates
public class InventoryUI : MonoBehaviour
{
    public GameObject itemPrefab;
    public Transform itemContainer;
    
    public void RefreshInventory(List<Item> items)
    {
        // Clear existing items
        foreach (Transform child in itemContainer)
        {
            Destroy(child.gameObject);
        }
        
        // Create new items
        foreach (var item in items)
        {
            var itemGO = Instantiate(itemPrefab, itemContainer);
            itemGO.GetComponentInChildren<Text>().text = item.name;
            itemGO.GetComponentInChildren<Image>().sprite = item.icon;
            // More manual setup...
        }
    }
}

Resolution Handling: Complex anchor/pivot configurations. Nested layout groups for responsive design. Screen size variations require careful planning.

UI Toolkit: The Document-Based System

UI Toolkit brings web development patterns to Unity. Structure with UXML, style with USS, control with C#. No GameObjects for UI elements. The visual UI Builder tool provides a Figma-like interface for designing UI without code.

UI Toolkit Architecture

// UI Toolkit uses documents and queries
public class MainMenuUITK : MonoBehaviour
{
    [SerializeField] private UIDocument document;
    
    private Button playButton;
    private Button settingsButton;
    private Label titleLabel;
    
    void OnEnable()
    {
        var root = document.rootVisualElement;
        
        // Query elements by name or class
        playButton = root.Q<Button>("play-button");
        settingsButton = root.Q<Button>("settings-button");
        titleLabel = root.Q<Label>("title-label");
        
        // Register callbacks
        playButton.clicked += OnPlayClicked;
        settingsButton.clicked += OnSettingsClicked;
        
        // Modify properties
        titleLabel.text = "Game Title";
    }
    
    void OnPlayClicked()
    {
        // Add USS class for transition
        document.rootVisualElement.AddToClassList("fade-out");
        
        // Or manipulate style directly
        playButton.style.opacity = 0.5f;
    }
}

UXML Structure

<!-- MainMenu.uxml -->
<ui:UXML xmlns:ui="UnityEngine.UIElements">
    <ui:VisualElement name="main-menu" class="menu-container">
        <ui:Label name="title-label" class="game-title" />
        <ui:VisualElement class="button-group">
            <ui:Button name="play-button" text="Play" class="menu-button primary" />
            <ui:Button name="settings-button" text="Settings" class="menu-button" />
            <ui:Button name="quit-button" text="Quit" class="menu-button" />
        </ui:VisualElement>
    </ui:VisualElement>
</ui:UXML>

USS Styling

/* MainMenu.uss */
.menu-container {
    flex-grow: 1;
    background-color: #1a1a1a;
    justify-content: center;
    align-items: center;
}

.game-title {
    font-size: 72px;
    color: #ffffff;
    -unity-font-style: bold;
    margin-bottom: 50px;
}

.button-group {
    flex-direction: column;
    width: 300px;
}

.menu-button {
    height: 60px;
    margin: 10px;
    font-size: 24px;
    background-color: #2c2c2c;
    border-radius: 8px;
    border-width: 2px;
    border-color: #505050;
}

.menu-button:hover {
    background-color: #3c3c3c;
    border-color: #808080;
}

.primary {
    background-color: #0080ff;
    border-color: #0080ff;
}

UI Toolkit Strengths

Performance: No GameObject overhead. Efficient retained-mode rendering. Batching handled automatically.

Modern Workflow: Familiar to web developers. Separation of concerns. Hot reload USS changes.

Data Binding (Experimental but functional):

// UI Toolkit data binding
public class PlayerStatsUI : MonoBehaviour
{
    [SerializeField] private UIDocument document;
    private Label healthLabel;
    private ProgressBar healthBar;
    
    void Start()
    {
        var root = document.rootVisualElement;
        healthLabel = root.Q<Label>("health-label");
        healthBar = root.Q<ProgressBar>("health-bar");
        
        // Bind to data changes
        PlayerStats.OnHealthChanged += UpdateHealth;
    }
    
    void UpdateHealth(int current, int max)
    {
        healthLabel.text = $"{current}/{max}";
        healthBar.value = (float)current / max * 100f;
    }
}

Built-in Virtualization: ListView and TreeView handle thousands of items efficiently:

// Efficient list rendering
public class InventoryUITK : MonoBehaviour
{
    private ListView inventoryList;
    
    void SetupInventory(List<Item> items)
    {
        inventoryList.itemsSource = items;
        inventoryList.makeItem = () => new VisualElement();
        inventoryList.bindItem = (element, index) =>
        {
            var item = items[index];
            element.Q<Label>("item-name").text = item.name;
            element.Q<VisualElement>("item-icon").style.backgroundImage = 
                new StyleBackground(item.icon);
        };
        
        // Handles 10,000+ items smoothly
    }
}

UI Toolkit Limitations

Animation Constraints: No Timeline support. Limited to transitions and simple animations:

// UI Toolkit animation limitations
public class PanelAnimation : MonoBehaviour
{
    private VisualElement panel;
    
    void AnimatePanel()
    {
        // Only transition-based animations
        panel.style.transitionDuration = new List<TimeValue> { new TimeValue(0.3f) };
        panel.style.transitionProperty = new List<StylePropertyName> { 
            new StylePropertyName("opacity"),
            new StylePropertyName("translate")
        };
        
        // No complex animation curves or blend trees
        panel.style.opacity = 0;
        panel.style.translate = new Translate(0, -50);
    }
}

Missing Features: No mask component. Limited shader effects. No particle system integration. World space UI requires workarounds.

Learning Curve: New mental model for Unity developers. USS quirks. UXML verbosity. Different event system.

Performance Comparison

Tested on Unity 2022.3.10f1 LTS with identical functionality.

Test Configuration

  • Hardware: Desktop (RTX 3070, i7-10700K) and Mobile (Samsung Galaxy S21)
  • Scenario: 1000 interactive UI elements
  • Measurements: Unity Profiler, deep profiling disabled

Unity UI performance comparison chart - UGUI vs UI Toolkit draw calls, frame time, and memory usage benchmarks

Benchmark Results

MetricUGUIUI ToolkitImprovement
Draw Calls4559x fewer
CPU Frame Time12.5ms4.2ms3x faster
Memory Usage125MB48MB2.6x less
Instantiation (100 items)85ms15ms5.7x faster
Scroll PerformanceStutters at 500+Smooth at 10,000+20x+ capacity

Real-World Scenarios

Inventory System (500 items):

// UGUI: Noticeable hitches
foreach (var item in inventory)
{
    Instantiate(itemPrefab, container);
}
// Result: 3-4 frame drops, 95ms spike

// UI Toolkit: Smooth operation
inventoryList.itemsSource = inventory;
inventoryList.Rebuild();
// Result: No frame drops, 12ms total

HUD Updates (every frame):

// UGUI: 0.8ms per frame
healthText.text = health.ToString();
manaText.text = mana.ToString();
expBar.fillAmount = experience;

// UI Toolkit: 0.2ms per frame
statsLabel.text = $"Health: {health} Mana: {mana}";
expBar.value = experience * 100f;

When to Use Each System

Unity UI system decision flowchart - Choose between UGUI and UI Toolkit based on your project requirements

Choose UGUI When:

Shipping within 3 months: Team knows UGUI. No learning curve. Proven workflow. Asset Store resources available.

Complex animations required:

// UGUI excels at animated UI
public class BossHealthBar : MonoBehaviour
{
    public Animator damageFlashAnimator;
    public Animator phaseChangeAnimator;
    public ParticleSystem damageParticles;
    
    public void TakeDamage(float damage)
    {
        damageFlashAnimator.SetTrigger("Flash");
        damageParticles.Play();
        
        // Complex multi-layer animations with particles
        if (health < 0.3f)
        {
            phaseChangeAnimator.SetBool("CriticalPhase", true);
        }
    }
}

VR/AR projects: World space UI essential. Hand tracking interactions. Spatial interfaces. UI Toolkit requires complex workarounds.

Small mobile games: Simple UI needs. Known performance profile. Quick iteration cycles.

Choose UI Toolkit When:

Data-heavy interfaces:

// UI Toolkit handles complex data efficiently
public class CraftingSystemUI : MonoBehaviour
{
    private ListView recipeList;
    private ListView ingredientList;
    private VisualElement preview;
    
    void ShowRecipes(List<Recipe> recipes)
    {
        recipeList.itemsSource = recipes;
        // Smooth even with 1000+ recipes
    }
    
    void FilterRecipes(string search)
    {
        var filtered = recipes.Where(r => r.name.Contains(search));
        recipeList.itemsSource = filtered.ToList();
        // Instant filtering, no lag
    }
}

Editor tools: Consistent with Unity’s own UI. Same system for runtime and editor. Better integration.

Desktop/console primary: Higher resolution displays. Complex layouts. Keyboard/mouse interaction. Performance headroom utilized.

Starting fresh: No legacy code. Time to learn. Want future-proofing.

Hybrid Approach

Both systems can coexist:

Unity hybrid UI approach diagram - Using UGUI for game HUD and UI Toolkit for menus in the same project

public class HybridUIManager : MonoBehaviour
{
    [Header("UGUI - Game HUD")]
    public Canvas gameplayCanvas;
    public HealthBar healthBar;
    public AmmoCounter ammoDisplay;
    
    [Header("UI Toolkit - Menus")]
    public UIDocument mainMenuDocument;
    public UIDocument inventoryDocument;
    public UIDocument settingsDocument;
    
    private UIState currentState;
    
    public void ShowGameplay()
    {
        // UGUI for real-time game UI
        gameplayCanvas.enabled = true;
        HideAllUIDocuments();
        currentState = UIState.Gameplay;
    }
    
    public void ShowInventory()
    {
        // UI Toolkit for data-heavy interfaces
        gameplayCanvas.enabled = false;
        inventoryDocument.rootVisualElement.style.display = DisplayStyle.Flex;
        currentState = UIState.Inventory;
    }
}

Migration Guide

Moving from UGUI to UI Toolkit? Start strategically.

Migration Strategy

  1. New features first: Build new screens with UI Toolkit. Keep existing UGUI screens.

  2. Identify bottlenecks: Profile your UI. Find performance problems. Migrate those components first.

  3. Component mapping:

UGUI ComponentUI Toolkit Equivalent
ButtonButton
Text/TextMeshProLabel
ImageVisualElement with background
SliderSlider
ToggleToggle
InputFieldTextField
DropdownDropdownField
ScrollViewScrollView
LayoutGroupFlex layout (CSS)

Migration Example

Before (UGUI):

public class ShopItemUGUI : MonoBehaviour
{
    public Text itemName;
    public Text itemPrice;
    public Image itemIcon;
    public Button buyButton;
    
    public void Setup(ShopItem item)
    {
        itemName.text = item.name;
        itemPrice.text = $"${item.price}";
        itemIcon.sprite = item.icon;
        
        buyButton.onClick.RemoveAllListeners();
        buyButton.onClick.AddListener(() => Shop.BuyItem(item));
    }
}

After (UI Toolkit):

public class ShopItemUITK : VisualElement
{
    private Label nameLabel;
    private Label priceLabel;
    private VisualElement iconElement;
    private Button buyButton;
    
    public ShopItemUITK()
    {
        // Load UXML template
        var visualTree = Resources.Load<VisualTreeAsset>("ShopItem");
        visualTree.CloneTree(this);
        
        // Cache references
        nameLabel = this.Q<Label>("item-name");
        priceLabel = this.Q<Label>("item-price");
        iconElement = this.Q<VisualElement>("item-icon");
        buyButton = this.Q<Button>("buy-button");
    }
    
    public void SetItem(ShopItem item)
    {
        nameLabel.text = item.name;
        priceLabel.text = $"${item.price}";
        iconElement.style.backgroundImage = new StyleBackground(item.icon);
        
        buyButton.clicked += () => Shop.BuyItem(item);
    }
}

Common Gotchas

Event handling differences:

// UGUI
button.onClick.AddListener(HandleClick);

// UI Toolkit  
button.clicked += HandleClick;
// Remember to unsubscribe!
button.clicked -= HandleClick;

Positioning differences:

// UGUI uses RectTransform
rectTransform.anchoredPosition = new Vector2(100, 50);

// UI Toolkit uses style
element.style.left = 100;
element.style.top = 50;
// Or use translate for relative movement
element.style.translate = new Translate(100, 50);

2025 Unity Roadmap Insights

Unity’s investment clearly favors UI Toolkit:

  • New features exclusive to UI Toolkit
  • Better performance improvements each release
  • Growing documentation and samples
  • Editor modernization uses UI Toolkit

According to Unity’s roadmap, UI Toolkit receives continuous improvements while UGUI remains in maintenance mode.

UGUI receives:

  • Bug fixes
  • Compatibility updates
  • TextMeshPro improvements
  • Maintenance mode effectively

Practical Recommendations

New Projects Starting Today

Mobile Casual: UGUI if launching within 6 months, UI Toolkit if longer timeline Desktop/Console: UI Toolkit for better performance at higher resolutions VR/AR: UGUI still superior for spatial interfaces Live Service: UI Toolkit for easier updates and data-driven content Prototype: UGUI for fastest iteration

Existing Projects

Keep UGUI if:

  • It works without performance issues
  • Team has deep UGUI expertise
  • Heavy animation usage
  • Shipping soon

Migrate to UI Toolkit for:

  • Performance problems with current UI
  • Adding data-heavy features
  • Building editor tools
  • Major UI overhaul planned

FAQ

Can I use both UI systems in the same project?
Yes. Many projects use UGUI for game HUD and UI Toolkit for menus. They coexist without issues.

Is UGUI deprecated?
No. Unity actively maintains UGUI. It receives bug fixes and compatibility updates, just not major new features.

Which performs better on mobile?
UI Toolkit generally performs better, especially with many UI elements. Simple UGUI interfaces work fine on mobile.

Can I animate UI Toolkit elements?
Yes, but limited to CSS-like transitions. No Timeline or Animator support like UGUI has.

Should I migrate my existing UGUI project?
Only if you have performance problems or need UI Toolkit features. Working UGUI doesn’t need migration.

What about TextMeshPro?
Works with UGUI only. UI Toolkit uses its own text rendering system with comparable features.

Coming Next: Complete Unity Project

Want to see these concepts in action? In Part 2 of this series, we’ll build a complete Unity project showcasing:

  • Side-by-side UGUI and UI Toolkit implementations
  • Performance benchmarking scenes with real metrics
  • Hybrid approach examples for production use
  • Migration helpers and best practices
  • Complete Unity 2022.3 LTS project ready to explore

Stay tuned for “Building a Unity UI Comparison Project” where we’ll dive deep into practical implementations and provide a full GitHub repository with runnable examples

Conclusion

Both UI systems serve different needs in 2025.

UGUI remains excellent for animated, game-like interfaces with quick development cycles. Its GameObject approach feels natural to Unity developers.

UI Toolkit excels at data-driven, high-performance interfaces with modern development patterns. Its document-based approach scales better.

Choose based on your specific needs:

  • Timeline? UGUI for immediate shipping, UI Toolkit for longer development
  • Performance critical? UI Toolkit
  • Complex animations? UGUI
  • Data-heavy? UI Toolkit
  • Team expertise? Use what you know for tight deadlines

The future belongs to UI Toolkit, but UGUI isn’t disappearing. Make the pragmatic choice for your project.


Need Expert Unity UI Development?

Struggling to choose the right UI system for your Unity project? Our Unity Certified Expert team specializes in:

  • UI Performance Optimization - Reduce draw calls and improve frame rates
  • UGUI to UI Toolkit Migration - Smooth transition strategies
  • Custom Unity UI Solutions - Tailored to your project needs
  • Unity AR/VR UI Development - Specialized spatial interfaces

Contact us for a free Unity UI consultation →


Stay Updated with Unity Development Tips

Don’t miss Part 2 of this series! Get notified when we release “Building a Unity UI Comparison Project” with complete source code.

Plus, receive weekly Unity optimization tips, best practices, and industry insights directly in your inbox.

Subscribe to our newsletter on the blog →


Need help choosing or migrating UI systems? Contact us for Unity UI consulting.

Angry Shark Studio Logo

About Angry Shark Studio

Angry Shark Studio is a professional Unity AR/VR development studio specializing in mobile multiplatform applications and AI solutions. Our team includes Unity Certified Expert Programmers with extensive experience in AR/VR development.

Related Articles

More Articles

Explore more insights on Unity AR/VR development, mobile apps, and emerging technologies.

View All Articles

Need Help?

Have questions about this article or need assistance with your project?

Get in Touch