- Home /
How to use one button to play different audio for different Targets?
Hi I have a problem. Here is description. I use Vuforia library for Unity.
I am going to recognize few imageTargets and I would like to play sound with onClick(button). This button is on canvas and it is always on top during the app lifetime. So You can see it always. Behind this button You can see camera view and recognize markers.
F.e I have two markers: Dog and Cow. Dog has assigned audio - bark. Cow has assigned audio - muu.
When I recognize Cow -> click the button and it should give me muu sound, but when I recognize Dog, the same button, when clicked should give me bark sound. Here is a problem. I cannot resolve it. I think I should write a script for this button to play sound onClick for appropriate marker, but I do not know how to tell button that now I can see Cow (play muu onClick) and another time I can see Dog (play bark onClick). To sum up - How to give button info which audiofile should it use,Hi I have a problem. Here is description. I use Vuforia library for Unity.
I am going to recognize few imageTargets and I would like to play sound with onClick(button). This button is on canvas and it is always on top during the app lifetime. So You can see it always. Behind this button You can see camera view and recognize markers.
F.e I have two markers: Dog and Cow. Dog has assigned audio - bark. Cow has assigned audio - muu.
When I recognize Cow -> click the button and it should give me muu sound, but when I recognize Dog, the same button, when clicked should give me bark sound. Here is a problem. I cannot resolve it. I think I should write a script for this button to play sound onClick for appropriate marker, but I do not know how to tell button that now I can see Cow (play muu onClick) and another time I can see Dog (play bark onClick). To sum up - How to give button info which audiofile should it use.
Your answer
Follow this Question
Related Questions
Create a collider in my 3D image file., 0 Answers
Camera is disabled while running Unity, cannot run any saved unity projects 0 Answers
Cloud recognition in Vuforia 0 Answers
Trying to load a prefab but getting null error 4 Answers
The type or namespace name `ICSharpCode' could not be found. 2 Answers