Wire capture button to UDT capture event

To enable user defined target (UDT) events, we need to add Vuforia's UDT Event Handler component to the UserDefinedTargetBuilder:

  1. With UserDefinedTargetBuilder selected in Hierarchy, Add Component UDT Event Handler.
  2. Drag the UserDefinedTarget from Hierarchy onto the Image Target Template slot.

Now we can tell the button that OnClick events should call the BuildNewTarget() function:

  1. In the Capture Target Button's Inspector, press the + on OnClick().
  2. Drag the UserDefinedTargetBuilder onto the Object slot.
  3. And set the function to BuildNewTarget().

The following screenshot shows the Capture Button OnClick setup for the UDT Event Handler:

Save your work. Now when you press Play, point your webcam at ...

Get Augmented Reality for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.