Create and Destroy
- Cody Mader
- Apr 4, 2021
- 2 min read
Working with UI has been enjoyable to me so far, and I'm taking interest in Unreal's blueprint system. I'm still learning new things about it every time I do some work with the UI and while sometimes it has been a pain trying to find info on specific aspects of the system, it's been fun. I designed and set up the main menu UI and begun work on integrating volume control with sliders for our players to use. Implementing that volume control wasn't too difficult, however, it brought an issue to my attention. The way I swapped UI elements was by creating and destroying them every time you went into a different part of the menu. This caused a problem with audio where it would reset the volume each time. This was a problem that took a bit of time for me to solve due to having a hard time finding resources for getting references to other UI widgets.
Solving this problem was a challenge but ended up having a much easier solution than I thought, albeit a messy one. The idea I had was to initialize each element of the UI at the creation of the main portion and just set their visibility to be hidden until they were needed. This was simple enough but an issue arose when I needed to go back an element and didn't have a reference to it in order to set it back to being visible. I searched for ways to get references during the start on the individual elements but the solution was much easier. Instead of getting references in the individual element, when I create each element, I set their references then. While this solved my issue it did look messy due to the way blueprints are. I also made the blueprint look cleaner by turning that section of creating UI elements, setting their visibility, and references into a function so it only took up one block instead of multiple within the view for the main blueprint.
Kommentarer