Hello. I have a problem with a simple GUI button where I have 2 textures. One that is normal button, and the other where the button is hovered. Here is my script :
var normalTex : Texture2D;
var hoverTex : Texture2D;
function OnMouseEnter(){
guiTexture.texture = hoverTex;
}
function OnMouseExit(){
guiTexture.texture = normalTex;
}
So, I added a normalTex and in it put this script. Put my textures into normalTex, and hoverTex and when button clicked nothing happens. Problem with the script? Thanks.
basically the script is all fine
but the problem is on your functions all you need to do is change function onMouseEnter(){
to
function OnMouseEnter(){
you will notice that in your script you have written onMouseEnter.
Now in unity if you are using its build in functions they always start with a capital so the on has to be On not on here is the correct code :
123
123 var normalTex : Texture2D; var hoverTex : Texture2D;
function OnMouseEnter(){
guiTexture.texture = hoverTex;
}
function OnMouseExit(){
guiTexture.texture = normalTex;
}123
123
other than that your code is great i hope this has helped you