How to show the mouse cursor at runtime in C++?

Yes, my mistake, sorry. You either need to cast it to APlayerController or you can just use AController. So you need to either change your code to this:



APlayerController* PC = Cast<APlayerController>(GetController());

if (PC)
{
PC->bShowMouseCursor = true; 
PC->bEnableClickEvents = true; 
PC->bEnableMouseOverEvents = true;
}


Or this:



AController* PC = GetController();

if (PC)
{
PC->bShowMouseCursor = true; 
PC->bEnableClickEvents = true; 
PC->bEnableMouseOverEvents = true;
}


3 Likes