- Home /
How to put an object as a button or a button that appears as a tracking model
I'm trying to put for example a plane, or a cube (GameObject) with a texture, but this object have to react like a GUIButton, but my code is in c++ , how do i can make this happen???.. please help i have trayed all. but nothing works for me.. :S
for example a stop(); or a play(); button to play audio.
Im developin for IOS , so have to be touch.. So i cant use On$$anonymous$$ouseDown
I see your problem. You're right, mouse scripts won't work for iOS. The solution is to raycast it. This answer looks about right:
http://answers.unity3d.com/questions/141893/detecting-taps-on-3d-objects-in-ios.html
I forgott to say that is for ios, so have to ve touch, thats the problem, it could be onmousedown..mm
Answer by moghes · Jun 07, 2012 at 07:18 PM
if you want your cube to appear always on the top of everything, you have to use 2 cameras. to see this is detail check this question I asked a while ago http://answers.unity3d.com/questions/248295/can-i-have-a-prefab-appear-on-my-screen-like-a-gui.html
and to make it react for your mouse , simply create a script(c# which is almost similar to C++) since you can write in unity either C#,javascript or Boo. And attach the script to you box(gameobject) that will be your button.
The script should look like this: function OnMouseDown() { // play your audio }
make an another search to know better on how to play your audio file!
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Cannot click UI button. 4 Answers
Why does IsSleeping() keep returning false? (Billiard Logic) 0 Answers
How to get a parent object after clicking the childObject 1 Answer
Help touch button 1 Answer