What are the proper uses of FViewport::ShowCursor() and ShowSoftwareCursor()?

I’m trying to do some simple test with mouse interaction and I came across FViewport::ShowCursor(), FViewport::ShowSoftwareCursor(), and FViewport::SetMouse(). My assumption is I should be able to just use these to set a mouse position directly, which works, but I think I’m missing a step. With the following code:

void ATestInputActor::BeginPlay()
{
    GEngine->GameViewport->Viewport->ShowCursor(true);
}

void ATestInputActor::Tick( float DeltaTime )
{
    //Some simple obvious values to test
    GEngine->GameViewport->Viewport->SetMouse(100,100);
}

I can see the results of my SetMouse() call when I press Shift+F1 to show mouse cursor, is there a way I can have this be the default state when I push play or start the game, i.e. not having to push Shift+F1 to see the cursor? I’d prefer to do this without a playercontroller (just to keep the test simple), and I want to stay in C++, no blueprints. Thanks!

Hello,

To show/hide the cursor, you need to set/reset the bShowMouseCursor from the player controler.

ThePC->bShowMouseCursor = true;

Thanks for the reply, that’s what I was thinking too, but I’m really curious as to if there’s a way to do this without a player controller, really like I said just for simplicity. It’s not a hard, fast requirement, but would be good to know.