I want to change the mouse cursor for an actor for “cursor over”.
My code:
void
AMyClass::NotifyActorBeginCursorOver()
{
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Cyan, TEXT("NotifyActorBeginCursorOver:: Mouse Over"));
}
APlayerController* pPc = GetWorld()->GetFirstPlayerController();
if (pPc)
{
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Cyan, TEXT("NotifyActorEndCursorOver:: PlayerController IS here"));
pPc->CurrentMouseCursor = EMouseCursor::Hand;
}
}
I get for mouse overs always both outputs.
When I just started the game, nothing happens but the output on the screen.
When I left click once,
then I always get the correct mouse cursor when the above code is executed.
Any ideas?
I did the blueprint variant, that works. But I’d prefer to do it in C++.
Not sure if this is even the same problem, but just in case, here a link to an old topic: https://answers.unrealengine.com/questions/140503/currentmousecursor-set-in-playercontroller-is-only.html