How to use ContextActionService for touch?

I tried to use ContextActionService for using touch inputs for an action but when I do, it seems that i cannot move the screen or interact with other objects. How would I use ContextActionService without removing other functionality on mobile devices?

When you bind an action to an input with ContextActionService that input will by default be sunk. To allow the touch through to the camera controller just return Enum.ContextActionResult.Pass from the bound function.
Hope this helps!

What does it mean for an action to be sunk?

When an action is sunk, it signifies that the action has already been handled and other functions bound to that input will not be called. Essentially pass allows the other functions such as the camera function to run, while sunk stops the input from reaching anywhere else. Keep in mind that this is priority based, so if a function is bound at priority 2 it’ll run before a function bound at priority 1, and if the priority 2 function sinks the input then priority 1 function will never run, however if it passes the input the priority 1 function will run, and if it also passes the input and there’s a priority 0 function it’ll run too.
See ContextActionResult for more info.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.