- Home /
Question by
Fuhans · Nov 22, 2013 at 07:32 PM ·
c#turn-basedtooltip
On Mouse Click Button event
Hai guys, i already could show the tooltip on each button whenever the mouse button hover that button. However, the button function did not run, but the tooltip shown.
Here is the code:
Rect buttonRect = new Rect(0, Screen.height - buttonHeight * 3, buttonWidth, buttonHeight);
Rect tooltipRect = new Rect(100 + 10, Screen.height - buttonHeight * 3 + 5, buttonWidth, buttonHeight);
public virtual void TurnOnGUI()
{
label1.normal.textColor = Color.red;
//Text Field
if (GUI.Button(textRect, ""))
{
}
//ToolTip Text
GUI.Button(buttonRect, new GUIContent("Move", "Move the Player"));
GUI.Label(tooltipRect, GUI.tooltip, label1);
GUI.tooltip = null;
//Move Button
if (GUI.Button(buttonRect, "Move"))
{
if (!moving)
{
GameManager.instance.RemoveTileHighlights();
moving = true;
attacking = false;
GameManager.instance.HighlightTilesAt(gridPosition, Color.blue, movementPerActionPoint);
}
else
{
moving = false;
attacking = false;
GameManager.instance.RemoveTileHighlights();
}
}
(.... other codes...)
Here is the image (Mouse hover at Move Button):
When i delete the tooltip text, the function run like the image below (Move Button):
How do i solve this guys? Thanks in advance!
untitled.png
(237.6 kB)
untitled1.png
(240.0 kB)
Comment
Your answer
Follow this Question
Related Questions
Disable the GUI when the character moving 2 Answers
Center camera on object in unity3d by programatically 1 Answer
Show the GUI button when mouse hover to the object 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers