- Home /
Tooltip with GUI.TextField
var stringToEdit : String = "Hello World"; function OnGUI () { stringToEdit = GUI.TextField (Rect (10, 10, 200, 20),stringToEdit,GUIContent ("start1"));
if(GUI.tooltip == "start1")
{
GUI.Label (Rect (130,835,300,40), "enter in text field");
}
}
BCE0023: No appropriate version of 'UnityEngine.GUI.TextField' for the argument list '(UnityEngine.Rect, String, UnityEngine.GUIContent)' was found.
when i am trying to use tool tip text field
Answer by robertmathew · Mar 11, 2011 at 11:48 AM
var stringToEdit : String = "";
function OnGUI() { stringToEdit = GUI.TextField(Rect(10, 10, 200, 20), stringToEdit, 25); GUI.Label(Rect(10, 10, 300, 50), GUIContent(" ", "label1"));
if (GUI.tooltip == "label1")
{
GUI.Label(Rect(210, 30, 300, 40), "enter in text field");
}
}
Answer by Statement · Mar 10, 2011 at 06:41 PM
Check the reference on GUI.TextField. None of the parameters are of type GUIContent, yet you try to supply one.
Error happens here:
stringToEdit = GUI.TextField(..., ..., GUIContent("start1"));
I guess you need to set the tooltip manually if the mouse is over the rect.
manually means i cannot get you can u modify this code with out error
robert, as I wrote, the TextField doesn't provide any means to set the tooltip since it doesn't accept any GUIContent. Normally you'd set the tooltip via the GUIContent. See the link I posted for yourself. It's a flaw in Unity or something.
$$anonymous$$aybe you can cheat around it by having an empty label underneat it?
thanks a lot you are first to answer all my question with correct answer it is working fine
Your answer
Follow this Question
Related Questions
How to assign a different tooltip to each GUI button? 0 Answers
C# Multiple GUI.Tooltips 2 Answers
Text Alignment 2 Answers
C# GUI.Tooltip If Statement 2 Answers
Tooltip when mousing over a game object? 0 Answers