- Home /
Question by
jessee03 · Feb 13, 2013 at 08:31 PM ·
guitexture
can OnMouse events call a guitexture through code
I create my guitextures through code and was wondering if I can have seperate events be called for a specific guitexture without having to create it in my scene. I create my guitexture using this GUI.DrawTexture(Rect((Screen.width/2) - 129, 820, 36, 36), icon1); But I would like to have multiple icons in a single script and still be able to access a seperate OnMouse event for each one. Can this be done?
var normalTex : Texture2D;
var hoverTex : Texture2D;
function OnMouseEnter () {
guiTexture.texture = hoverTex;
}
function OnMouseExit(){
guiTexture.texture = normalTex;
}
function OnMouseDown(){
Debug.Log("clicked");
}
Comment