Other controls are hilighted by the mouse when you’re dragging an active control (e.g. scrollbar).
If you run the code below and start dragging the slider and the mouse goes over a button, the button will (incorrectly) hilite.
var guiSkin : GUISkin;
var confirmationMessage : String = "Are you really sure you want to do that? I'm not sure it's such a great idea.";
private var windowRect : Rect;
private var s : float = 50;
function Start() {
windowRect = Rect (Screen.width - 340, Screen.height - 140, 320, 120);
}
function OnGUI () {
GUI.skin = guiSkin;
windowRect = GUI.Window (0, windowRect, WinConfirm, "Confirmation");
}
function WinConfirm (windowID : int) {
GUI.Label (Rect (10, 20, 300, 60), confirmationMessage);
// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
if (GUI.Button (Rect (140,90,80,20), "Cancel")) {
print( "Cancel" );
}
// Make the second button.
if (GUI.Button (Rect (230,90,80,20), "OK")) {
print( "OK" );
}
s = GUI.HorizontalSlider( Rect(10,60,300,10), s, 0, 100 );
// Make window draggable
GUI.DragWindow (Rect (0,0, 10000, 20));
}
I have that problem too - i don’t know of a way to control the ‘highlighting’ of a textfield.
Ideally the Focus script function or TAB key should highlight the entire contents of a textfield, and move the caret to the initial position in a textarea.
Nicholas, I’m using the password masking script you gave us before and when I double click to highlight the password, everything but the first character gets selected. Triple clicking highlights the whole lot.
Any ideas?
Nicholas, I just submitted the case - haven’t had an email about it. Issues are below, just in case the report went to the cyberdump.
Provide a summary of the issue:
GUI Highlighting Inconsistency
Steps to Reproduce: Detail the steps taken to produce the bug.
Problem 1: Double clicking on the password field highlights all but the first character
Problem 2: Highlighting the username and then tabbing doesn’t keep the ‘highlight mode’ for the password
Inconsistency: Highlighting any number of characters in the password field keeps the highlight mode when Tabbing to the username field.
Problem 3: Under VISTA, the Tab action actually adds the TAB character to the text or password field
Problem 4: Under VISTA, even after setting the ‘hot’ control, it still requires two Tabs to move to the next field. There’s also some weirdness highlighting in Vista, but I’m not able to test it here
Problem 5: If the OSX Input type is set to any stroke based language (CJK), Unity doesn’t respond to the input (generally apps just display a box in place of the char if the font doesn’t exist, but it usually does if you can select the input method, which is another problem entirely) To reproduce, try enabling Korean Hangul 2-Set Input mode and type anything into a Unity textbox.