Search Unity

How to show the name of the player of another color

Discussion in 'Editor & General Support' started by jeff.fnd, Mar 28, 2014.

  1. jeff.fnd

    jeff.fnd

    Joined:
    Jul 31, 2013
    Posts:
    10
    Hello everybody.

    I need a script that shows the name of the player on top of his head, but if the player is a realm different from mine, the color of the name must be different.

    I'm using the script below, but do not know how to compare my realm and the other player.

    If the kingdom is different from mine, it would show the name of another color.

    Code (csharp):
    1.  
    2. Transform target;
    3.  
    4.         if (!photonView.isMine){
    5.  
    6.             GUI.color = Color.blue;
    7.  
    8.             screenPos = Camera.main.WorldToScreenPoint(target.position);
    9.             screenPos.y = Screen.height - screenPos.y;
    10.             screenPos.z = 0f;
    11.             GUI.Label(new Rect(screenPos.x-40,screenPos.y-55,100,20),""+playerName);
    12.         }
    13.  

    It would be something like this video below:
    https://www.youtube.com/watch?v=gmCstH5nPsk


    Please could someone help me?