Hi, My Simple Machmaking seems to be almost finished. however i am trying to display the “Playercount” as a gui on the screen so user know how many players their are in a room on the machmaking screen “waiting for players”
using UnityEngine;
using System.Collections;
public class NetworkClassic : MonoBehaviour {
// Machmaking Auto on Room Load Seaching for players
//when players hit Max Count Losd Game.
const string VERSION = "v0.0.1";
public string Avatars = "User";
public GameObject UsersConected;
// Use this for initialization
void Start () {
PhotonNetwork.ConnectUsingSettings(VERSION); //Connect to Photon Network for EAO.
}
void OnJoinedLobby()
{
RoomOptions roomOptions = new RoomOptions() { isVisible = false, maxPlayers = 10 };
PhotonNetwork.JoinOrCreateRoom(null, roomOptions, TypedLobby.Default);
// find a room, if a room is full creat a new random room and wait Users to connect.
}
// Serch for players.
void OnJoinedRoom()
{
UsersConected.guiText.text = PhotonNetwork.countOfPlayers; // Display number of conected Users as GUI>
if (PhotonNetwork.countOfPlayers == 10) //wait for 10 players to conect before starting game.
{
// Unlock Users and Start the Game.
}
} // end of joined room
} // /end of class