1
\$\begingroup\$

I'm new to photon Networking. My game was working great suddenly this is appearing

Cannot send messages when not connected. Either connect to Photon OR use offline mode! UnityEngine.Debug:LogError(Object)

\$\endgroup\$
0
\$\begingroup\$

Remove the player already in the scene and try to connect again. The PUN is trying to connect the player with the server.. Hope this will solve your problem.

All The Best

\$\endgroup\$
0
\$\begingroup\$

This is mine part of code, which is used to connect to the room by client

void OnConnectedToMaster() {
    RoomOptions roomOptions = new RoomOptions () { isVisible = false, maxPlayers = 5 };
    PhotonNetwork.JoinOrCreateRoom ("TestRoom", roomOptions, TypedLobby.Default);
}

void OnJoinedRoom() {
    PhotonNetwork.Instantiate ("Player", spawnPoint.position, spawnPoint.rotation, 0);
}

I guess they've changed something in API (using PUN only for the first day), but this is the code snippet which helped me to get it up and running (others were outdated and using OnJoinedLobby method.

I hope it will help you to solve your problem.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.