# Behaviour of SetInputMode on mobile

**URL:** <https://forums.unrealengine.com/t/behaviour-of-setinputmode-on-mobile/478769>\
**Category:** Mobile\
**Tags:** Mobile, Input, unreal-engine, mouse-click, question, UMG\
**Created:** [February 14, 2021, 6:05am UTC](https://forums.unrealengine.com/t/behaviour-of-setinputmode-on-mobile/478769 "2021-02-14T06:05:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mortinger391](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mortinger391](https://forums.unrealengine.com/u/mortinger391)\
**Post date:** [February 14, 2021, 6:05am UTC](https://forums.unrealengine.com/t/behaviour-of-setinputmode-on-mobile/478769/1 "2021-02-14T06:05:38Z")

</div>

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! 😉
