Display additional text before the variable that the user is editing in a GUI Text Field

I have a GUI text field and I want to display additional text in it
ie: First Name " + myVariable

Here is my script:

myVariable = GUI.TextField(new Rect(Screen.width/2-(300/2), 225, 300, 25), "First Name: "+myVariable, 30);

I am Using C#.
Here is what I am getting:

Any help would be appreciated. Thanks.

Your problem is that you are including “First Naame” in your field, so thats part of what gets returned and stored back in your variable. next time around, it doe sit again, adding “First name:” again, and so on.

What you need to do is to use a Horizontal group and a label for your label, not make it part of the text in the text area. Like this:

GUILayout.Label("First Name:");
myVariable = GuiLayout.TextField(myVariable);

If you want to position the whole thing somewhere then wrap it in GUILayout.BeginArea()/GUILayout.EndArea().

Alternately you could manually position both the label and the text field by pixel coordinates, but thats a needless hassle.