Beispiel #1
0
    public void SetName()
    {
        string name = nameField.text;

        Debug.Log("Name: " + name);
        if (name.Length > 0 && name.Length <= 32)
        {
            GameObject[] gameObjects = GameObject.FindGameObjectsWithTag("LobbyPlayer");
            foreach (GameObject playerObject in gameObjects)
            {
                LobbyPlayer player = playerObject.GetComponent <LobbyPlayer>();
                if (player.isLocalPlayer)
                {
                    player.SetName(name);
                }
            }
            SwitchToRoleSelect();
        }
    }