How do i keep a static variable local to a client instance (c#) ?

I have a connection script, it takes a "public static" variable as a players name. Another script uses that variable to display the players name above it head. BUT when a new player connects it changes the static variable for all players and hence updates all of the players names to the new players name. How do i make a variable static on the client side but not static across the network? (or, as I suspect, I am approaching this the wrong way ?)

thanks andrew

As you want to have multiple players, you can't use a static variable as that will have exactly the effect you experienced: A static variable is "unique" across the whole application (it's the same for any instance of that given class). In other words: It can always only have one value at a time for all instances of that class (that's what "static" means).

Instead of using a static variable, you should probably have the player names as instance variable of a script attached to the game object that represents the player. Then, of course, you'll need some way to distinguish between the game objects of the different players and assign those variables accordingly. Also, you may need to access the player game objects from the code the shows the player names (if it's attached to a different game object; otherwise, if both scripts are attached to the same game object, you can simply use GetComponent() from the script that shows the player name).