Create button for actor interface

Hi guys,
I’m new to UE and so far I love it :slight_smile: however I can’t figure out how to do something and since search didn’t helped I decided to ask here.

I’m making a blueprint actor for small grass patches that are placed manually in the level and you have the option to choose different meshes, different scale and different rotation for each instance that’s placed in the level.
Now I would like to have a button that when pressed it randomizes some of these properties but I can’t manage to find a way to create a UI button using blueprints.

Randomizing the properties is not the issue and I can get a the same functionality if I use a bool that I toggle on and off but having a button to press on the actor interface would be more pleasant.

Thanks,

I did a tutorial for a basic button setup for your HUD class. Take a look, it might be what your looking for.

Button Tutorial

Edit: Are you referring to a randomize button inside the editor? or in game?

Hi pattym,

Thanks for the help but I probably didn’t explained well enough - I’m looking for a way to create a button on the actor user interface to randomize it inside the editor,
here’s a quick mock-up of what I’m referring to:

201281-randomizeeditorbutton.png

So I guess there’s no way to do something like adding a button on the actor UI to trigger an action inside the blueprint?

Not that I’m aware of, there probably is though as I believe the whole UI for the editor is done in slate. Your best bet would be to toggle a bool as you mentioned in your initial post.

So to make a button on any blueprint actor, what you want to do is add a collision box inside the blueprint.

Make sure your player controller has mouse events and mouse click events enabled (I assume this is already true).

Next, in your actor blueprint event graph, add an OnClicked or OnReleased click event to your collision box and bam, button inside actor. To make a background for said button, you can use a billboard image or a 3d mesh.

We are planning to add a feature that will let you expose Events in a BP as button in the detail panel, much like i think you describe! Hopefully we will get to it quite soon (probably 4.5).

Hi Levon, thanks for the suggestion but is not exactly what I need.

James, that sounds awesome, keep up the great work guys!

Ah yes, my fault for misunderstanding, hopefully you find a solution or it gets implemented.

That sounds like a great feature!

Hmm, when would that be? Getting excited… :smiley:

>Hmm, when would that be?
>about 4 lines of code to expose buttons in bp’s
>almost 2k19
pff

this is available for a while, just create a custom event in your blueprint, and check on “call in editor”, after compile, a button will appear when you select your blueprint in the level editor.

Only restriction is that a custom event cannot have any inputs, but you can set those separately as exposed variables.

2 Likes