I read that ONGui() is not recommended for phones and tablets and the other alternative is GUITexture. But I find GUITexture (Create Other → GUITexture) annoying and hard to control its position with the pixelInset.
My question is: Is there any other way to create HUD/UI?
I already have my UI on my ONGui() but i want to port the game over to tablets and phones.
One of the most retarded thing i did was not using the OnMouseEnter() function and instead coded something like:
if (self.pixelInset.Contains(Input.mousePosition))
{
self.texture = hoverTexture;
}
Which gave me a hard time! Because if you put pixelInset x and y to 0 and have transform.position to be 0.5,0.5, the above code only works if your mouse is at the bottom left.
URGH! I feel so stupid! Well im just sharing this in case anyone runs into the same problems as me in the future.
PS: Seems to me that there isnt any other way to create GUI except for GUITextures.
I find it hard to control the GUITextures using pixelInset so instead i use the XYZ cordinaties to posistion the guis on screen to were on i want them and then use the pixel inset componet on the GUITexture to fine tune the GUI textures. Check out this like if you looking for touch input…