Vuforia: Playing Sound when image detected and stop sound when image lost. The simplest way (2021 Updated)

Prerequisite

  1. A sound, you can find some free sounds from here http://soundbible.com/

Lets Start!

Drag and Drop the sound to your ImageTarget

Playing sound on Image Detected

While your ImageTarget is selected, on the Inspector window drag and drop AudioSource to the On Target Found() Object slot

Click the function selector and select AudioSource > Play()

Stopping sound on image lost

While your ImageTarget is selected, on the Inspector window drag and drop AudioSource to the On Target Lost() Object slot

Click the function selector and select AudioSource > Stop()

Final check

Default Trackable Event Handler should now look like this

Done, lets test it!

When image is detected, you sound will play and when image is lost, the sound will stop.

I have multiple Image Targets and sound to implement. How?

Its okay you now know all you need to know to do this. All you have to do is repeat these steps from “Let’s Start” to the end for each of your Image Target.

That’s all, happy creating

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s