- Home /
Selectable GUI texts?
So I'm trying to make a Portal 2 type Main Menu. For example, when you hover over the GUI text it will change colors and when you click on it it will take you to the next scene. Here's an example of what im talking about. like when you hover over the text, there is like a select bar. Video Example
Please Help!
Answer by Java666 · May 28, 2014 at 09:12 PM
i would assume they are using the gui Button but just have text for the button, otherwise should be able to use the unction OnMouseOver () to change colour and Input.GetMouseButton for clicking it to react the way you wish
void OnMouseOver()
{
if(Input.GetMouseButton(0))
{
gameObject.guiTexture.color = Color.white;
Application.LoadLevel("selectorScene"); //the name of another scene file or scene index.
}
else
{
gameObject.guiTexture.color = Color.red;
}
}
this is code i used to change a button colour to red when over it and to function when i left click it
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
(C#) GUI Buttons not working 1 Answer
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
unit selection issue 0 Answers