0
\$\begingroup\$

I am trying to add networking to my game via Photon Realtime and have a unity scene set up with this script attached to one of my game objects :

public class Multiplayer : MonoBehaviourPunCallbacks
{
// Start is called before the first frame update
void Start()
{
    PhotonNetwork.ConnectUsingSettings();
}

public override void OnConnectedToMaster()
{
    Debug.Log("OnConnectedToMaster() was called by PUN.");
    RoomOptions roomOptions = new RoomOptions();
    roomOptions.IsVisible = false;
    roomOptions.MaxPlayers = 4;
    PhotonNetwork.JoinOrCreateRoom("ChunckyMonkey", roomOptions, TypedLobby.Default);
}


public override void OnJoinedRoom()
{
    base.OnJoinedRoom();
    Debug.Log("Room was Joined.");
}


public override void OnJoinRoomFailed(short returnCode, string message)
{
    base.OnJoinRoomFailed(returnCode, message);
}
}

I can see the corresponding logs in unity's output but when I run the game with two oculus headsets I do not see the other player. So it seems to be working according to photon but I don't see it. This is using quest 2 unity version 2019.4.31f1. Could photon be configured incorrectly or sending each player to a new room ?

\$\endgroup\$
2
  • \$\begingroup\$ Since you are setting the room to private with isinvisible and you can't join a private room by random joining, you should include the relevant code on how you make sure the two people are actually in the same room. \$\endgroup\$
    – Zibelas
    Jul 11, 2023 at 6:24
  • \$\begingroup\$ Hehe very silly of me, I did change it to public and still no luck. Says connected but when putting the headset on with another person I don't see them in the same scene \$\endgroup\$
    – Doug Ray
    Jul 16, 2023 at 23:14

1 Answer 1

0
\$\begingroup\$

Well, that was silly of me. In addition to needing the room isVisible to be set to true, you have to set isOpen to true for others to be able to join. Makes sense.

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .