Unity – Scripting – OnGUI – Settings

Videogames Development – Unity – Code GUI Objects – Settings

Inside Text Area, selected text comes in with cyan highlight.

1. Assign the script to the Camera:

#pragma strict
     
	// Sets the selection color to cyan
	var str : String = "This is a string with\ntwo lines of text";
	function OnGUI() { 
		GUI.skin.settings.selectionColor = Color.cyan;
		str = GUILayout.TextArea(str);
	}

Setting List:

GUI.skin.settings.selectionColor = Color.cyan;

.selectionColor The color of the selection rect in text fields.
.cursorColor The color of the cursor in text fields.
.cursorFlashSpeed The speed of text field cursor flashes.
.doubleClickSelectsWord Should double-clicking select words in text fields.
.tripleClickSelectsLine Should triple-clicking select whole text in text fields.