- Home /
Unity Photon Network Help
So I am watching this tutorial on how to use unity photon networking and I done everything it has showed me, but I get a different result then the video.
Its suppose to connect to a lobby, and join a room if there is one, if not, create one. I have the debug.logs to show if it is working, but when I run it, it's only showing OnJoinedLobby, and none of the other logs in the console. Can someone help me please?
{
void Start ()
{
Connect();
}
void Connect()
{
PhotonNetwork.ConnectUsingSettings("Version 1.0");
}
void OnGUI()
{
GUILayout.Label(PhotonNetwork.connectionStateDetailed.ToString());
}
void OnJoinedLobby()
{
Debug.Log("OnJoinedLobby");
PhotonNetwork.JoinRandomRoom();
}
void OnPhotonJoinRandomFailed()
{
Debug.Log("OnPhotonJoinRandomFailed");
PhotonNetwork.CreateRoom(null);
}
void OnJoinedRoom()
{
Debug.Log("OnRoomJoined");
SpawnMyPlayer();
}
void SpawnMyPlayer()
{
PhotonNetwork.Instantiate("Player", Vector3.zero, Quaternion.identity, 0);
}
}
It should be OnPhotonRandomJoinFailed ins$$anonymous$$d of OnPhotonJoinRandomFailed,
Thank you so much! That fixed my problem.
Your answer
Follow this Question
Related Questions
Unity multiplayer solutions: Photon, Unity Networking - what else and in what way is good? 0 Answers
Photon network won't join random room with a custom property 0 Answers
Photon connections problems caused by a script? 2 Answers
PUN - Choose random Hero for player 0 Answers
How to hide an object from other clients using PUN 2 0 Answers