Receiving click messages

I’m sure this is a huge noob question, but couldn’t find the answer in the documentation or support requests:

I’m using the “Top Down” project in C++ and trying to get mouse click events.

I see that AActor has a ReceiveActorOnClicked() method, and I add that to my character class (ACodeTopDown3Character : public ACharacter), but it doesn’t get called when the player character is clicked. Do I need to do something else to ensure that this gets called?

bEnableClickEvents needs to be true in your PlayerController class to enable the click events.

Marc, I’m not seeing anything called bEnableClickEvents anywhere in PlayerController or AActor or anywhere in the whole code base. Are you running a more recent version of the engine than I am?

I don’t think so. Using the most recent Rocket beta I see that variable there and to be certain you could create a blueprint that inherits from player controller and see if it has the Enable Click Events property in its defaults.

Does it not compile if you put bEnableClickEvents = true; in the constructor of your game’s player controller class?

That’s correct; it has no idea what that variable is and it does not compile if I add that line.

Never mind; fixed now. My mistake.

Dear Paul,

I am not sure what version you are using,

But in my version, the latest and only version I have, Marc Audy’s information is correct:

On line 172 of playercontroller.h

// Whether actor/component click and touch events should be generated
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=MouseInterface)
uint32 bEnableClickEvents:1;

Good luck!

Rama

Thanks, Rama – That did the trick. I’d been looking in the wrong place for this, and I’d set up my Find in Files dialog wrong so it wasn’t finding it. Derp :wink:

Yay! Glad you got it all figured out :slight_smile: