GUIUtility.keyboardControl Manual     Reference     Scripting  
Scripting > Runtime Classes > GUIUtility
GUIUtility.keyboardControl

static var keyboardControl : int

Description

The controlID of the control that has keyboard focus.

JavaScripts
// Click on the text field to see the id of the control.

private var str : String = "A String!";
function OnGUI() {
str = GUILayout.TextField(str,10);
Debug.Log("id: " + GUIUtility.keyboardControl);
}

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
private string str = "A String!";
void OnGUI() {
str = GUILayout.TextField(str, 10);
Debug.Log("id: " + GUIUtility.keyboardControl);
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

private str as string = 'A String!'

def OnGUI():
str = GUILayout.TextField(str, 10)
Debug.Log(('id: ' + GUIUtility.keyboardControl))