I bet you can’t type an A!
Keys got special meaning and shouldn’t be fed into parts of the GUI? This handy little snippet takes care of that job:
private string text = "I bet you can't type an A!";
{
if( !Event.current.isKey )
{
return;
}
foreach( KeyCode key in keys )
{
if( Event.current.keyCode == key )
{
Event.current.Use();
}
}
}
{
DisableKeys( new KeyCode[]{ key } );
}
{
DisableKey( KeyCode.A );
text = GUILayout.TextArea( text );
}
1 Comment
→
I tried this code but seems not works in Unity2.6.1 , still can type ‘A’ there.