I have buttons in my main menu which would change texture upon mouse over. The changing of the textures on mouse over works fine in the editor. But after build, the textures do not show at all when the button is moused over. It is simple a blank button. I know the button is still there because I am able to click on it and it will execute a function.
This is how I have done it in code.
void Start()
{
PathStartBtn1 = “Assets/Textures/Buttons/Start_Default.png”;
PathStartBtn2 = “Assets/Textures/Buttons/Start_MouseOver.png”;
Tex2D_StartBtn1 = (Texture2D)Resources.LoadAssetAtPath(PathStartBtn1, typeof(Texture2D));
Tex2D_StartBtn2 = (Texture2D)Resources.LoadAssetAtPath(PathStartBtn2, typeof(Texture2D));
}
void OnMouseEnter()
{
gameObject.guiTexture.texture = Tex2D_StartBtn2 ;
}
void OnMouseExit()
{
gameObject.guiTexture.texture = Tex2D_StartBtn1 ;
}
The funny thing is the original texture for the button does show up when the game starts. Only when the cursor goes over it, it simply disappears.
Please help… Anyone?