Here I’m going to post what I found out that was useful for me when using Unreal Engine, maybe it will help others as well. I encourage others to post a replay to this with what they think is useful to know, and I’ll edit this main thread and add a quote to that suggestion to keep it more organized, easier to find/see. The following suggestions aren’t in any special order! Use Ctrl + F
to search for key names (GameMode
, Button
, Widget
…).
Never be afraid or avoid to experiment with the engine functionalities. Experiment with the capabilities of widgets, actors, timers by event or with anything that you might need but you don’t yet understand how it works. You can always create a testing project so you won’t be afraid to break anything.
You don’t know how to something, and you can’t find the answer on the internet? Don’t be afraid to ask here on unreal engine forum or on other websites. Just ignore the trolls or the “smart people” that just want to show what they know and make you feel bad that you don’t know that. In case the website has a system to give you negative mark (‘-’) on your question, don’t feel bad if you get one, as most websites don’t have a system to balance it, to make it actually mean something, and there are people that don’t even read what you ask and press the - button, just because they can, and know they will make someone feel bad.
I. Widgets
- Create a simple square image that is white and use it with any widget element that has
Style / Image
and don’t just leave it asNone
in case you aren’t going to set an image, and only use a color. Doing this will display the correct color, as I had a situation where the color I was setting inTint
wasn’t the actual color displayed. Also, in case UE devs are going to change what “None” means, your colors won’t be messed up. - If you are going to have widget elements (
Button
,Combo Box
…) on multiple widgets that are going to have the same style (same color for example), then make a “base widget” that only contains that element (only a button for example), and use that widget as a replacement inside other widgets (instead of adding a button, add theButtonW
you created). Doing it like this, if you want to change the color of that button on all the widgets, then you won’t have to go into each one and apply the change, you only have to go intoButtonW
for example and change that with the new style, which will change the style to any widgets that used it.
- As an example I made a widget
ButtonW
that only contains only a button. The widget is set toDesired
size. Then when I’m using this in other widgets, I’m getting fromButtonW
the button and I’m usingBind Event to On Click
to set what the button should do. You can even create combinations of widgets that you created. As a more complex example I made aTextW
, and aTextBoxW
and combined them in a 3rd widgetLabeledTextBoxW
(in this I added aHorizontalBox
and inside it the two widgets, I also added two variablesSizeLabel
,SizeTextBox
that are instance editable and I’m setting them onEvent Construct
, to be able to have a dynamic way to change the size they take inside theHorizontalBox
). This way I can add aTextBox
that already has aLabel
to it. And the same, I only have to change the style of the baseTextW
andTextBoxW
. At first it may take some time making them as you want (with any variables you may want to have, and maybe be instance editable) but for me it was well worth it.
II. General
- Try to get used to create a parent actor for any situation where more then 1 actor is going to have some of the same variables (values can be different, and most likely will be), functions and events, and from that create as many children’s as you need.
- As an example, I’m using this for
GameMode
,GameState
,PlayerState
,PlayerController
, where I have a parent for each of them that contains general functions, events and variables (ex: player spawn function, variables nickname / is player ready / team id…), and then from those for each map I’m making a child that has functions, events and variables that are only used on that map.
-
If you want to add in memory a number / string / … (anything supported by wildcard) that is random generated and use it in multiple locations but you don’t want to set that as a variable, then create a
Blueprint Macro Library
, inside it aMacro
(I chooseSet Aux
as name) with the following content.
Usage:
-
You should learn to use
Soft Object References
as they will be useful to manage memory usage in some situation, like when you don’t know what character the player will use and to avoid adding all of them into memory. This video can be useful to watch to learn a bit more about this subject. -
If you need two variables with the same name (especially in a function), just add a space at the end of the 2nd (3rd…) one. This way Unreal Engine will allow you to have them “the same name”. In the following example you can’t have the same variable name for input and output, but I just added a space at the output value name.