Clearing a GUI.TextArea on click, active or focus

I’m designing a user interface for a simple racegame and have made a level where the players can give in their names.
the textarea’s are created inside a FOR-loop limited by the amount of players. by default i’ve set these values to player1,2,…

Is there a way I can somehow access the events called when a textarea is selected so I can
1)clear the default text
or
2)select the default text so it dissapears upon new input ?

My code so far

var arr=new Array();
arr[0]=“player1”;
arr[1]=“player2”;
arr[2]=“player3”;
arr[3]=“player4”;

for(i=0;i<PlayerPrefs.GetInt(“NumberofPlayers”);i++){

arr = GUI.TextArea (Rect (0, yw, 250, 25),arr*);*
yw+=25;
PlayerPrefs.SetString(“player”+i,arr*);*
* }*
Anyone got a sollution for this issue ?
Thx Wouter

I think you may try something like this:

  • give a name to your textarea by putting GUI.SetNextControlName(“myTextArea”); right before GUI.TextArea…
  • use GUI.GetNameOfFocusedControl==“myTextArea” to detect when your textarea is selected

This should get you going :slight_smile:


(It is sad that no one could help me with building a plugin bundle for osx. That’s why I’m helping others more from now on)