- Home /
Click a Gui Texture and Trigger Shoot1?
I want to click a gui texture which has a box collider around it and I want it to trigger the shoot1 function.
Is it possible? and could anyone tell me the script for the function of trigger "shoot1" thank you :)
Answer by robertbu · Jul 17, 2013 at 02:50 PM
GUITextures live in Viewport space. Box colliders live in World space. So you cannot have a box collider around a GUITexture. You could have a box collider track a GUITexture or have a GUITexture track a box collider. See Camera.ViewportToWorldPoint() and Camera.WorldToViewportPoint().
As for clicking on a GUITexture, you don't need a collider. You can add this to a script on the GUITexture:
function OnMouseDown() {
Shoot1();
}
This assumes Shoot1 is in the same script as the OnMouseDown(). If it is not, see:
Your answer
Follow this Question
Related Questions
android game slower on pc than on mobile 3 Answers
FPS view limited - I don't know why 0 Answers
Making an Animated Image Sequence 1 Answer
AddForce applies different amount on Android than PC 0 Answers
Locking the frame rate 0 Answers