I applied a script to my guiTexture and it stopped accepting mouse clicks…anytime i disable the script the texture accepts mouse clicks.The script is below.
var x,y,a,b:float = 0.5;
function Update() {
var myTexture:GUITexture = GetComponent(GUITexture);
myTexture.pixelInset = Rect (x*Screen.width, y*Screen.height, a*Screen.width, b*Screen.height);
}
How do you get the mouse click? GUITexture has no collider so you need to convert the mouse position to screen and then check for Rect intersection.
– fafasePlease explain more don't really understand
– el-santia93Usually you have to assign a Collider component to the Object to get the Object responding the Click Event. Unfortunately, GUITexture objects can't have a Collider component. What fafase was trying to say is that you should check the position of the cursor when clicking, and if it is inside the rectangle where your GUITexture is, call the event.
– Vereosyeah thanks.....figured a way round this challenge
– el-santia93