QUICK DEV TIP #50 UE4 / UE5 - EDITOR CALL EVENTS AT RUNTIME

Today’s trick is useful for helping you test and tweak values!

Did you know you can use custom events to trigger functionality while playing in editor?

If you would prefer to watch the video version, check it out here

Below you can see an example of what we are going to quickly achieve. While playing in editor we can select the cube and go to its details pannel. There we can see two custom buttons that have functionality tied to them. In my example, the buttons speed up and slow down the rotation rate.

QDT_Blog01_GIF_TWITTER.gif
 

Behind the scenes this is really easy to setup. If we take a look inside the blueprint you can see that there is nothing fancy going on.

QDT50_Blog02.JPG
 

When creating a new custom event or clicking on a current one, if you take a look in the top right details panel you will see an option called Call in Editor. Turning this to true is all we need to do.

QDT50_Blog03.JPG
 

If you then compile and save your blueprint you will see that the icon in the top left of the custom event changes to a little cog. You can tie any functionality that you want to this event.

QDT50_Blog04.JPG
 

Then when we return to the play in editor view we can see that we have our new button exposed!

QDT50_Blog05.JPG
 

This works in exactly the same way in the Early Access Version of Unreal Engine 5 as well.

QDT50_Blog06.JPG
 

This can be super useful for tweaking non-player elements at runtime. For the player, we can hijack the inputs e.g. 1, 2, 3, 4, 5 to affect functionality. But for non-player elements, this is harder. I really like the method we have been talking about because it allows me to set up and perform incremental changes without having to stop play in editor, change a setting, run play in editor again, etc. Instead, I can live tweak something like for example an A.I.’s rotation speed at runtime, then when I find a value I like I can just hard set it in the blueprint. A much more fluid process!

If you want more quick tips & tricks FOLLOW ME ON TWITTER @cbGameDev

Also, check out the parkour game I'm solo developing called Freerunners. Give it a wishlist if you like the way it looks!: https://store.steampowered.com/app/1430330/Freerunners/