Cropout Sample Project - Unreal 5.5.4 - Mega Learning Thread

[INFO DUMP: UI_Button / UI_Prompts / CUI_Styles]

Here we go again, while I still remember what I was doing in the project so it’s easier for me to remind myself in case of another break and if whoever is patient enough to read all of that gets any value from my trials and errors, even better.

1. UI_Button


Nothing too complicated here as to my surprise there is no OnClicked logic on the UI Button as to my understanding the Button is meant to just exist and be pushed/added to bigger UI chunks, so the only thing we do is hook up the text, prepare the height box so things don’t get squeezed and add the Input Action (this one is my nightmare as things look obvious but feel otherwise - then again, more reason to practice and get out of my comfort zone).

Surprisingly, there was no logic for a focused state either (keyboard). I had to make one (or I just didn’t tick the right box, smarter people will know). Sadly, I couldn’t figure out yet how to not have duplicated overlays when you quickly swap from mouse to keyboard while mouse is still hovering, but thing are good enough, so moving on.

Part of the solution was to create new Styles after finding out how to swap them out. I don’t think that’s the right solution but here we are.

2. CUI_Style

Every UI element that needs to be fancy requires some type of Style, however, as it is similar with Materials, unless you make a copy (instance) of it, all the values will be the same, so I have made a lot of new ones just so that the things could be more distinct (like smaller font for sections inside the Pause Menu or some readability improvements as my font is not that good and more padding was needed here and there).

The other thing I had to do was to name the Style as per the Parent class because I duplicated an incorrect Style Type many times and was scratching my head why it doesn’t work, as I kept forgetting it’s not a global style object.

In regards to the above, it took me fair bit of tweaking to put ito my head that margins are lines for the 9-slice.

The Materials that I already were using from the project itself were behaving, though I had to keep in mind that I have to make sure that the Border is drawn as the Box, otherwise it will end up like a squashed circle, so keep that in mind when you attach the Materials and change the margins. Also, the Image Size seems to matter as that can result in your boarder having different, not always smooth, corners. Again, because of how the Material is set up, not the Style.

3. UI_Prompt


I wish I understood the Event Dispatchers better because if I were to create things from scratch, I still wouldn’t be able to.

I do get that you have to:

  1. Create the Disaptchers in the UI you want to push to the stack
  2. Bind the Events in other UI that will use the UI_Prompt to the Confirm / Back dispatch message
  3. Add the logic to OnClicked for the other UI
  4. Add the dispatch calls to the OnClicked events

I feel I’m missing something still, though. What I remember I had to do last time the buttons broke was to bind the Confirm/Back somewhere in the Designer? but I can’t find it at the moment, or it was just my imagination. The names were important.

We will see in the future. Not the most intuitive system, though my lack of experience doesn’t really help.