Hi Lens creators! This quick guide explains how to setup fullscreen touches that work for both iOS and Android. To allow your Lens to respond to the "Tapped" event for fullscreen touches, you first need to tell the Snapchat user interface to ignore touches (allowing your Lens to take touch priority). You do this by enabling "Touch Blocking".
To enable fullscreen taps, first add the following script to your project bound to the "Initialized" event.
// The following script enables touch blocking which allows
// the tapped event to respond to fullscreen touches. It then
// enables touch blocking exceptions which allows Snapchat to
// still respond to certain types of inputs
global.touchSystem.touchBlocking = true;
This turns on "Touch Blocking" but still allows Snapchat to respond to double tap (to switch cameras) and swipe (to go to chat / stories) through touch blocking exceptions. IMPORTANT: Make sure the above script is bound to the "Initialized" event so it's enabled as soon as the Lens starts.
Next, add your fullscreen tap logic to a script bound to the "Tapped" event. For example, the below script toggles an object on and off when fullscreen tapped:
// @input SceneObject object
if( script.object.enabled )
script.object.enabled = false;
script.object.enabled = true;
Please sign in to leave a comment.