Second post about recently learned Unreal tips. I might collate those into a single post eventually, for now it’s easier to make small ones as I go.
Gameplay Tags
If you don’t know about Gameplay Tags, get excited because they’re an amazing feature. I’ve been using them for a while now and they’re useful in any project. In a nutshell, gameplay tags are hierarchichal tags that objects can hold, and that game code can check against. The GAS system (see below) is also completely structured around gameplay tags. Those things are so versatile and pleasant to use, you might get as obsessed with them as me :)
So for example you can have a Unit.Player
and Unit.Enemy.Boss
tag, or Attribute.Health
, or Action.Spell.Fireball
. Those tags can be used in all sorts of context, where objects can have tag containers and you can query things like “does this object have the Unit.Enemy
tag?” and then any tag that is a child of Unit.Enemy
will also be considered true.
In a lot of cases, it replaces usage of enums, or hardcoded strings. For example let’s say you want to create a state and actions machines for your characters, you could define tags like:
-
State.Idle
-
State.Moving
-
State.Attacking
-
Action.Melee.LightAttack
-
Action.Melee.HeavyAttack
Then you could create an actor component that holds those tags and can run actions, checking and setting tags based on what you want to do / can do. This article goes into more details.
Changing Escape keybind to stop play mode
I don’t know about you, but Escape is usually a button my game uses as a keybind. When testing in PIE, I always found it frustrating that I couldn’t use my Escape keybind without stopping PIE. As it turns out, it is just a matter of changing the keybind.
In Unreal, go in the editor preferences and search for PIE. Then in the list of keybinds, find the Stop one that has Escape bound and change it to something less conflicting. I used Shift+Escape.
Rider editor shortcuts
I’ve been using Rider more and more for C++ and I love it, but here’s some really nice shortcuts I’ve learned:
- alt+o switches between the .h file and the .cpp file. This is really useful given how quickly you need to switch between the two.
- ctrl+. (if you use the VS Code shortcut style) context menu can auto-generate C++ definitions for your header files (you probably already knew this, but always worth mentioning).
Unofficial GAS documentation
The Gameplay Ability System is amazing. It does everything you could want from a stats and abilities system, all while being flexible enough to be used in any game I can think of, still giving you good performance, and network replication out of the box.
However, the official documentation is lacking (as always with Unreal), and it is a boilerplate-heavy, complex system to get into.
I recently found this Unofficial GAS Documentation which is a great resource with a lot of info and examples.
Look, it’s so comprehensive I can’t even fit the table of contents in one screenshot: