Problems hiding mouse in Widget at runtime

The level in question doesn’t have a player, but there is a PlayerController (input mode: FInputGameAndUI). At no point in the PlayerController script do I hide the mouse.

In this level, the mouse is initially visible, but I would like to hide it after clicking a button.

Things I’ve already tried:

  • Canvas->Cursor = EMouseCursor::None;
  • PC->SetShowMouseCursor(false);
  • PC->bShowMouseCursor = false;

I also did a test where I set CanvasPanel → Advanced → Cursor → None through the widget’s Blueprint in the editor. Then I ran the game, and the mouse was hidden. That’s why I need to know how to hide the mouse from the widget at runtime.