Behaviour of SetInputMode on mobile

I’m building a tower defense game.
I want a clickable button that spawns a tower on mouse pressed, have it follow the mouse cursor and stop when the mouse is released.

I’ve managed to get this behaviour on windows using a not focusable UMG button that:

  • spawns a tower
  • sets GetWorld()->GetFirstPlayerController()->SetInputMode(FInputModeGameAndUI());
  • “follow” the cursor in the game using LineTraceSingleByChannel.

Without setting GetWorld()->GetFirstPlayerController()->SetInputMode(FInputModeGameAndUI()); a second click is required after clicking the button to focus again on the world.

Unfortunately i cant make this work on mobile, there the behaviour is the same as on windows when not setting input mode even if doing so.

I’ve been stuck for a while on this issue any help is appreciated! :wink: