- Home /
Question by
UnityNoob123 · Feb 26, 2017 at 10:45 PM ·
networking
Lan Host Netwroking Room List?
So I am trying to make a server or room list using the lan host and client situation, not the matchmaking services. I don't know how to access the rooms if it is not created using the matchmaking feature. Is it possible to create a list of rooms without using matchmaking and if so what command would I use. I will add the small script that I have made below, and thanks for the help!
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine.Networking;
using UnityEngine.Networking.Match;
using UnityEngine;
public class joinGame : NetworkBehaviour {
List<GameObject> roomList = new List<GameObject>();
private NetworkManager networkManager;
[SerializeField]
private GameObject roomListItemPrefab;
[SerializeField]
private Transform roomListParent;
// Use this for initialization
void Start () {
networkManager = GetComponent<NetworkManager>();
ClearRoomList ();
AddRommsList ();
}
// Update is called once per frame
void Update () {
}
void AddRommsList () {
for (int i = 0; i < networkManager.matchHost.Length; i++) {
GameObject roomGO = Instantiate (roomListItemPrefab);
roomGO.transform.SetParent (roomListParent);
}
}
void ClearRoomList () {
for (int i = 0; i < roomList.Count; i++) {
Destroy (roomList [i]);
}
roomList.Clear ();
}
}
Comment
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
The magic key to networking? 0 Answers
UNET Bug with NetworkHash128 and Saving Prefabs 0 Answers
How stream unreliable data to only one server/client? 1 Answer