Week 9 - Foliage , Main Menu, Bug Fixes
This week I finished implementing the foliage system and fixed two bugs encountered during play testing. The foliage tool in UE5 places instances of the meshes into the landscape where they should grow. I have painted large clusters of trees, flowers and ground cover using our own imported models on the entire landscape. The foliage tool bundles all trees of the same mesh into a single GPU draw call, rather than having the GPU draw each tree as a separate actor it draws all trees of the same type together as a single draw call, this means that painting the foliage can result in hundreds of individual trees at an acceptable frame rate when using individual actors would create severe lag.
I also created the main menu this week. This is created using a Widget Blueprint. The main menu contains our logo image and four buttons for Start, Join/Host, Options and Quit, this menu also has an image placed behind all of the components. When I load in to playtest the main menu I was unable to use the cursor to press the buttons, I realised that the cause of this bug was there was no Event Construct node in the Widget Blueprint. Event Construct runs as soon as the Widget is created, without the Event Construct node the Set Input Mode UI Only command which displays the cursor could not run, I corrected this by placing a reference to the widget, setting it's Input mode to UI Only and then connecting this to the widget blueprint and then feeding it into the widget to set its input mode.
The second bug appeared when I was testing the packaged exported build, the start button was causing the game to crash when it loaded a new level. The cause of this crash was that I was using an Open Level by Name command which requires the name of the level as a string, in the packaged build these string names cannot be found in the changed file paths of the packaged game. I rectified this by changing this command to an Open Level by Object Reference command which points to the asset in the level rather than searching the name, this fixed the crash immediately.
I think the reason both of these bugs occurred was a failure to properly read through the blueprint execution flow before testing; knowledge of Widget Blueprint lifecycles is crucial and I will ensure that this knowledge is applied before I build a Widget in future projects.
Comments