Wowzers! I haven’t touched Unreal Engine since the end of 2016! That’s… that’s actually a little sad. I enjoy UE4 quite a bit! So let’s get back into this.
Now… just to avoid any confusion here. The last one of these Today I Learned posts I made was for Section 4, Lectures 105-109. Logic dictates that the next one (ie: this one) should start at lecture 110… but the course has seemingly added 5 additional videos at some point during the past 5(!!) months. So that said, let’s jump in at 115.
Section: 4 – Battle Tank – A Fun Tank Battle with Mortars
Lecture 115: User Interface (UI) in Unreal
– will create a UI widget, and a player controller which will spawn the widget
– right off the bat, Ben decides that he’s going to keep the low-poly version of his map. Here’s hoping that my previous decision to stick with high-poly doesn’t come back to bite me. I’m sticking with it though. Chances are, it’ll just look ugly in the end. I don’t care.
– And… of course I’m having what looks like this bug affecting my drop-down menus. Fixed in version 4.14. (sigh). This worked in December… which means Windows has broken something in the past several months. *This* is why I don’t want my operating system to have forced updates.
– So.. fuck. I guess I have to use a High Contrast option in Windows at the moment as I don’t want to migrate this tutorial. Fucking hideous.
– create a ui widget blueprint, and then set an image to be aligned (0.5, 0.5) to 0,0. Also drag the anchor to an appropriate place on screen.
– this will get attached to a player controller (which is a type of blueprint we need to create)
– in the player controller: on begin play -> create player ui widget (referencing the player ui) -> add to viewport
– connect the player controller to the game settings, and Bob’s your uncle.
Lecture 116: Main Menu Screens
– the start menu is going to exist in a new level
– the ui elements will be called from the level blueprint
– because I’ve set the player controller in the default game mode settings, the UI that was created in the previous tutorial will ALSO appear
– I wasn’t aware there was a “usage rights” filter for Google Image Search!
Lecture 117: UI Scale Box, Buttons & Mouse
– Need to show the player’s mouse (Get Player Controller -> Set Show Mouse Cursor) in the level blueprint
– In the MenuUI widget, we set the Image to be not variable
– You can import true type fonts into the game. Using a Text block, it’s pretty straight forward how to get it aligned
Lecture 118: Controller Ready Navigation
– first step is to make the start button do “something”
– make it variable, and add an onclicked event and tell it to load your desired level when it’s clicked
– this is fine for mouse, however we presently can’t do anything with the controller
– create a custom event which we can use to place our controller
– this custom event is created in the mainmenu blueprint, but the event is called in the level blueprint after we’ve created our widget
– back in the mainmenu blueprint, we can now use a Set Input Mode UIOnly node after the custom event to allow keyboard/controller use once our widget is ready
– we create a “Quit” action Mapping in the Engine Input settings, so that we can quit the game using a hotkey while playing
Lecture 119: Trial Packaging Your Game
– be sure to set a default map
– it’s important that we set input mode OFF of UI only after we open our game. Otherwise we will not have control of our game
– Remember…. “the safest order to use sockets is Add Socket > Add Preview Mesh > Position > Remove Preview Mesh > Rename”