Help Photon Cloud Join and Create Room

Options
Hello everybody
I have simple question i hope some people can help so !!
What i need is :
I want when the player run the game connecting to the server and firstly check if they are room with name for ex "test" well if they are will get in the room "test" if they are not room with this name will create room with name "test".
I try to do it before but i failed every time i hope i will find who can help me and thank you before .

Comments

  • You should read this tutorial http://doc.exitgames.com/photon-cloud/Marco_Polo_Tutorial.

    Here is the basics in C# from that tutorial.
    [code2=csharp]void Start()
    {
    // Connects
    PhotonNetwork.ConnectUsingSettings("1.0");
    }

    void OnJoinedLobby()
    {
    // Join a random room when we joined lobby
    PhotonNetwork.JoinRandomRoom();
    }

    void OnPhotonRandomJoinFailed()
    {
    // If there is no rooms, we create one
    PhotonNetwork.CreateRoom(null);
    }

    void OnJoinedRoom()
    {
    // We are now in the room
    }[/code2]
  • Hello friend
    Thank you for your replay but look what I want to do is not random join to room
    Look to the code :

    [code2=csharp]void Start()
    {
    // Connects
    PhotonNetwork.ConnectUsingSettings("1.0");
    }

    void OnJoinedLobby()
    {
    // Join a room when we joined lobby
    PhotonNetwork.JoinRoom("nameRoom");
    Debug.log("succes1");
    }

    void OnPhotonRandomJoinFailed()
    {
    // If there is no rooms, we create one
    PhotonNetwork.CreateRoom("nameRoom");
    Debug.log("succes2");
    }

    void OnJoinedRoom()
    {
    // We are now in the room
    }[/code2]

    But the first debug working and printed in the consol and the second don't working
  • You are no longer joining a random room so OnPhotonRandomJoinFailed() will not work use OnPhotonJoinRoomFailed() instead.

    [code2=csharp]void Start()
    {
    // Connects
    PhotonNetwork.ConnectUsingSettings("1.0");
    }

    void OnJoinedLobby()
    {
    // Join a room when we joined lobby
    PhotonNetwork.JoinRoom("nameRoom");
    Debug.log("succes1");
    }

    void OnPhotonJoinRoomFailed()
    {
    // If there is no rooms, we create one
    PhotonNetwork.CreateRoom("nameRoom");
    Debug.log("succes2");
    }

    void OnJoinedRoom()
    {
    // We are now in the room
    }[/code2]