Spark AR Scripting with TouchGesture requires Touch Gesture Patch to be enabled

In order to access TouchGestures (e.g., recognise a screen tap) in Spark AR, it seems I need to have a Screen Tap patch dragged into my patch editor. If I don’t have the Screen Tap Patch, then my console log throws the following error:

[Tap Gesture] Required capability is missing
script.js:64:2
runtime.js:45:14
runtime.js:274:0
runtime.js:97:0

And when I delete my Screen Tap Patch, the Capabilities settings has “Touch Gesture”, “Tap Gesture” greyed out and I’m unable to set it as available via the Capabilities under Settings.

I didn’t see this anywhere in the documentation. In general, do capabilities always have to be enabled by dragging the corresponding patch into the patch editor? Or is there a way to enable it purely via scripting?

There’s no way to do it automatically via scripting. At least not reliably. Sometimes it detects when a module is being used and sometimes it doesn’t. The simplest solution is to drag the required patch into the patch editor, but you should also be able to manually add the capability. I’m not sure why it’s blocking you from adding the capability, but I just tested v168 and I could add it manually.

Ah super helpful to understand that sometimes the patch needs to be there. Thank you very much!