How to get OnClick Events to work?

I try to get an OnClick Event to work in C++, but I realy struggle with it.
In MyGameMode I spawn some actors over a loop:

BrickPtr[i / 12][i % 12] = World->SpawnActor<ABrickActor>(Brick, GetSetBrickPosition(i), GetSetBrickRotation(i), SpawnParms);

And thats works fine.
But what I want is, when I click a brick in the game it should return his pointer. I don’t get this to work. Have someone an idea of how to do this?

If you need more input, please tell me :slight_smile:

As far as I know, there’s no-parameter onClick delegate. So, you can’t obtain reference to clicked object inside handler.
But you can subclass an Actor and add this listener inside this class. Than on trigger you can dispatch an event from this Actor with all necessary information.


You have to enable click events inside player controller to get them working. Your mesh also has to have collision shape which blocks Visibility channel.