changing the mouse cursor doesn't work (as expected)

Hi,

I want to set my mouse cursor when hovering over an actor. I tried to do so, using

void AActorModel::ReceiveActorBeginCursorOver()
{
	GEngine->AddOnScreenDebugMessage(-1, 5, FColor::White, "ReceiveActorBeginCursorOver");
	APlayerController* pc = GetWorld()->GetFirstPlayerController();
	pc->CurrentMouseCursor = EMouseCursor::Hand;
}

Although the debug message gets printed when I hover over the actor, the mouse cursor does not change. However, when I click on the actor and hold the mouse button, the mouse cursor does change (tested in the Editor).

Another bug is that the mouse cursor does not change until it is moved (see [this question][1]).

Trying to override the mouse cursor on a UMG button does not result in a change, too (already experienced by user LEMMiNO, see [this question][2]). I checked the following settings:

29858-umg-button-behaviour-cursor.jpg

Testing this with my HTML5 build, the mouse cursor does not change on any occasion.

Are those behaviours bugs or am I missing something?

Hey trutty-

How are you setting up the click/hold event such that the mouse is behaving properly? I was able to follow the code above to have the debug message appear however I want to compare the rest of my setup versus what you have to ensure I’m getting the same behavior you are.

Cheers

Hi ,

the only thing I do regarding the mouse, is the code I mentioned above and in my PlayerController I have some input- and axis bindings and the set following settings:

bEnableClickEvents = 1;
bEnableMouseOverEvents = 1;
bShowMouseCursor = 1;
DefaultMouseCursor = EMouseCursor::Default;
DefaultClickTraceChannel = ECollisionChannel::ECC_Visibility;

My other mouse properties are:

When I hover over my actor the mouse does not change at this moment. If I later click, the mouse cursor changes as long as the mouse button is pressed. After releasing the mouse button, the cursor changes back to normal. If I do not hover over my actor, the mouse cursor does not change when clicking and holding (which I guess is correct because the mouse cursor wasn’t changed because the ReceiveActorBeginCursorOver was not executed).

Thanks for investigating in this issue

Hey trutty-

Sorry for the delayed response. Are you still having problems setting the mouse cursor to change when hovering over an actor? I was able to use the code you posted above in the actor class, then when I spawn a blueprint of that class in the level and mouse over it the mouse cursor changed appropriately. Best of luck in your project.

Cheers

Hey ,

using UE 4.7.2, the cursor changes properly when hovering over my actor when playing in the Editor. However, the cursor change does not work with the HTML5 build and also not on my UMG buttons.

Using the UMG editor I was able to get the mouse cursor to change by checking “Is Hovered” with the input being the widget button and the output feeding into a branch node. The documentation (SWidget::IsHovered | Unreal Engine Documentation) shows that the code equivalent is SWidget::IsHovered() which you should be able to use in the same way.