To enable user defined target (UDT) events, we need to add Vuforia's UDT Event Handler component to the UserDefinedTargetBuilder:
- With UserDefinedTargetBuilder selected in Hierarchy, Add Component UDT Event Handler.
- 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:
- In the Capture Target Button's Inspector, press the + on OnClick().
- Drag the UserDefinedTargetBuilder onto the Object slot.
- 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 ...