private UIInput selectedInput = null;
..
..
..
public void OnNameChange()
{
UICamera.selectedObject = passInput.gameObject;
selectedInput = passInput;
}
void Update ()
{
if (UICamera.selectedObject != null && selectedInput != null)
{
if (UICamera.selectedObject != selectedInput.gameObject)
{
selectedInput.text = ""; //avoid showing the caret
selectedInput.selected = true;
}
}
}