I’m making a main menu for a game. Im using 3d text, not GUI. The “start game, quit game” buttons are going to start out in a greek language font, but I want it to change to the english translation when the player moves the mouse cursor over the word. how would I go about doing this?
first you add a collider to the text,
there is a fuction called “OnMouseOver” and “OnMouseExit”
if the mouse is on the text you need to get the “Text Mesh” Component, there you can change the color.
the code (C#) needs to look something like this:
public Color OnMouseOverColor = Color.yellow;
public Color OnMouseClickColor = Color.red;
public Color OnMouseExitColor = Color.white;
void OnMouseOver()
{
GetComponent<TextMesh>().color = OnMouseOverColor;
if (Input.GetButton("Fire1"))
{
GetComponent<TextMesh>().color = OnMouseClickColor;
}
}
void OnMouseExit()
{
GetComponent<TextMesh>().color = OnMouseExitColor;
}