Video: An animated title screen prompting the player to press any key
Quick Facts
- Project Name: UI Study
- Description: Frontend user interface study with Unreal Engine.
- Tech Stack: Unreal Engine 5.6, Common UI, C++
Introduction
I was asked to create some menus for a game demo we're building at work, so I decided to do some research on the topic. I can't post what my team is working on at the moment, so I've decided to show off what I've learned so far through my studies. This project explores the design and implementation of user interfaces in Unreal Engine. The focus is creating scalable and performant UIs that are intuitive and visually appealing.
Structure
Primary Layout Widget
So far, I've completed the first phase of the project: setting up the basic structure of the UI system. The entire system is built around a modular architecture that allows for easy maintenance and expansion. It's all built on top of a primary layout widget which holds 4 widget stacks. Widgets can be dynamically added to and removed from the stacks at runtime. Image 1 shows the hierarchy of the primary layout widget.
Asynchronous Loading
To push widgets to the stacks at runtime, I've implemented a Blueprint node in C++ that can asynchronously load and initialize new widgets as needed. See image 2. This node takes soft widget references as input and later pushes them onto the appropriate stacks. In this way, we can avoid loading a bunch of widgets at startup. I'm handling this functionality inside of the player controller at the moment, so this node allows the player controller blueprint to be as lean as possible.
Memory Footprint
The following images show the sizes in memory of all the assets created for the UI system as well as the Press Any Key screen. These add up to a total of approximately 32.5 KiB for the UI system—that's the player controller and primary layout widget—and 596.8 KiB for the Press Any Key widget assets. This shows that UI assets can quickly get expensive and it's important to manage them carefully. I'm not accounting for the C++ code in this analysis, but judging from the total size of all the files I've created for this project, approximately 24 KB so far, I'll assume it's negligible for now. A more extensive memory analysis is left for a future write-up.