UI with MVVM: Blueprint patterns (ViewModels, bindings, cues) โ
๐ UI & MVVM Documentation โ
MVVM System: โ
- ๐ Model-View-ViewModel (MVVM) - Complete MVVM architecture guide
- ๐ ViewModel Creation - ViewModel Blueprint setup
- ๐ UI Data Binding - Widget binding patterns
UMG & Widget System: โ
- ๐ UMG Widget Blueprints - Complete widget creation guide
- ๐ Widget Animation - UI animation and transitions
- ๐ Widget Interaction - 3D UI interaction
UI Architecture Tutorials: โ
- ๐ฅ Advanced Widget Architecture - Scalable UI system design
- ๐ฅ UI Performance Optimization - Efficient UI rendering
- ๐ฅ Responsive UI Design - Multi-resolution UI systems
๐จ MVVM Architecture โ
What/Why: Keep gameplay out of Widgets. MVVM makes UI robust and testable: ViewModels hold state; Widgets display and bind.
Prereqs
- Plugins: Model-View-ViewModel (MVVM)
Steps
- Create ViewModel BP classes
VM_PlayerStatus: Health (float), Stamina (float), HasInteract (bool), InteractPrompt (text)VM_InputHints: Move (text), Jump (text), Interact (text)
- Create Widgets and bind
WBP_HUD: progress bars bound toVM_PlayerStatus, prompt text bound toVM_PlayerStatus.InteractPromptWBP_InputHints: texts bound toVM_InputHints
- Route game events to ViewModels
- Player Pawn components emit events (OnDamage, OnStaminaChanged, OnTraceHitInteractable)
- In a UI Coordinator (Actor or Subsystem), listen and update ViewModels (no logic in Widgets)
- Show/Hide UI via state
- Use Gameplay Tags (UI.HUD.Visible) to toggle visibility
- For menus, swap mapping context to
IMC_UIand pause gameplay
Data
- DataAssets:
DA_UIThemefor colors/fonts/sizes;DA_InputDisplayfor platform-specific glyphs
Networking
- ViewModels exist on owning client only; replicate underlying game state to drive them
Performance
- Avoid ticking Widgets; rely on bindings and events
Testing
- Toggle HUD tag โ widgets visible/hidden
- Damage player โ Health bar updates
- Look at interactable โ Interact prompt shows correct text
Suggested prompts โ
- โUE 5.6 Blueprints only. Define
VM_PlayerStatus(Health, Stamina, HasInteract, InteractPrompt) and bind it inWBP_HUD. Show where to update the ViewModel from Pawn events.โ - โExplain how to avoid game logic in Widgets with MVVM. Provide a small โUI Coordinatorโ pattern in Blueprints.โ
- โHow do I toggle HUD visibility with a Gameplay Tag and switch input contexts for UI?โ
- โList common MVVM pitfalls in UE 5.6 and how to debug broken bindings quickly.โ
Prompts for this example
- โGiven
VM_PlayerStatusandWBP_HUDprogress bars, show the nodes to update Health/Stamina from a HealthComponent event.โ - โProvide Blueprint nodes to show/hide the HUD using tag
UI.HUD.Visibleand swap toIMC_UIwhen visible.โ