Search code examples
unity-game-enginevuforia

Unity3d and vuforia detecting if target appears


I am new here so I want to ask my first question. I am using unity3d and vuforia for augmented reality.

I already set up AR camera on my scene and target image and object and works perfectly.

I am trying to play a sound when my 3d model appears on stage but without any luck.

So far I tried to follow this tutorial: https://www.youtube.com/watch?v=4u177CpPbp8 but in the line public class PlaySoundOnImageTarget : MonoBehaviour, ITrackableEventHandler comes with an error on ITrackableEventHandler.

It's red colored and when I am moving my mouse on this it says "error CS0103: the name ITrackableEventHandler does not exist in the current context".

I tried to write the full code but a lot of lines come with almost the same errors.

Also, I tried this one: [https://developer.vuforia.com/forum/faq/unity-how-can-i-play-audio-when-targets-get-detected]

Any help, please?

I am using unity3d 5.4.2f2.


Solution

  • You will need to include Vuforia before you can use it.

    You can do so by placing Using Vuforia; at the top of your screen

    Next time you might also want to read through the pages of Vuforia as they already solve this and a lot of other very basic errors you might walk into in the near future.