GetRoomList Problems

Options

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System;

public class Connection : Photon.MonoBehaviour
{
// Dungeon Settings //
public string[] potprefabs;
public string[] chestprefabs;
public string dungeonPlayerPrefab;
// Hub Settings //
public string hubPlayerPrefab;
// Connection Settings //
public string Version = 1 + "." + SceneManagerHelper.ActiveSceneBuildIndex;

public string hubScene = "Hub";

void Start()
{
DontDestroyOnLoad(gameObject);
PhotonNetwork.autoJoinLobby = true;
}


void Update()
{
if (PhotonNetwork.connected == false)
{
PhotonNetwork.ConnectUsingSettings(Version);
}
}

void OnJoinedLobby()
{
Debug.Log("Joined Lobby, Attempting To Join Hub..");
}

void OnJoinedRoom()
{
Debug.Log("Joined Room " + PhotonNetwork.room.name);
}

void OnReceivedRoomListUpdate()
{
Debug.Log(PhotonNetwork.GetRoomList().Length);
}



}
This bit of code below is outputting 0 and i cant seem to find out why.. Is there a delay between the callabcks?


void OnReceivedRoomListUpdate()
{
Debug.Log(PhotonNetwork.GetRoomList().Length);
}

Comments

  • Damien
    Options

    using UnityEngine;
    using UnityEngine.UI;
    using System.Collections;
    using System.Collections.Generic;
    using System;

    public class Connection : Photon.MonoBehaviour
    {
    // Dungeon Settings //
    public string[] potprefabs;
    public string[] chestprefabs;
    public string dungeonPlayerPrefab;
    // Hub Settings //
    public string hubPlayerPrefab;
    // Connection Settings //
    public string Version = 1 + "." + SceneManagerHelper.ActiveSceneBuildIndex;

    public string hubScene = "Hub";

    void Start()
    {
    DontDestroyOnLoad(gameObject);
    PhotonNetwork.autoJoinLobby = true;
    }


    void Update()
    {
    if (PhotonNetwork.connected == false)
    {
    PhotonNetwork.ConnectUsingSettings(Version);
    }
    }

    void OnJoinedLobby()
    {
    Debug.Log("Joined Lobby, Attempting To Join Hub..");
    PhotonNetwork.JoinOrCreateRoom("Hub", new RoomOptions() { MaxPlayers = 10 }, null);
    }

    void OnJoinedRoom()
    {
    Debug.Log("Joined Room " + PhotonNetwork.room.name);
    }

    void OnReceivedRoomListUpdate()
    {
    Debug.Log(PhotonNetwork.GetRoomList().Length);
    }



    }

    This is the right code ^
  • jeanfabre
    Options
    Hi,

    Do you get the debug log that you "joined room" ?

    Bye,

    Jean