Hello everybody,
the server list finds all the lobbies flawlessly, but if a build is hosting, other builds can’t join, but the editor can. if the editor is hosting only the first build can join. if i start a second build, it can see the server but can’t join. But everything is find if i use join code(Relay). same happens with udp/dtls.
here are my scripts:
LobbiesList:
using System.Collections;
using System.Collections.Generic;
using Unity.Services.Lobbies;
using Unity.Services.Lobbies.Models;
using UnityEngine;
public class LobbiesList : MonoBehaviour
{
[SerializeField] private Transform lobbyItemParent;
[SerializeField] private LobbyItem lobbyItemPrefab;
private bool isJoining;
private bool isRefreshing;
private void OnEnable()
{
RefreshList();
}
public async void RefreshList()
{
if (isRefreshing) { return; }
isRefreshing = true;
try
{
QueryLobbiesOptions options = new QueryLobbiesOptions();
options.Count = 25;
options.Filters = new List<QueryFilter>()
{
new QueryFilter(
field: QueryFilter.FieldOptions.AvailableSlots,
op: QueryFilter.OpOptions.GT,
value: "0"),
new QueryFilter(
field: QueryFilter.FieldOptions.IsLocked,
op: QueryFilter.OpOptions.EQ,
value: "0")
};
QueryResponse lobbies = await Lobbies.Instance.QueryLobbiesAsync(options);
foreach(Transform child in lobbyItemParent)
{
Destroy(child.gameObject);
}
foreach(Lobby lobby in lobbies.Results)
{
LobbyItem lobbyItem = Instantiate(lobbyItemPrefab, lobbyItemParent);
lobbyItem.Initialise(this, lobby);
}
}
catch (LobbyServiceException e)
{
Debug.Log(e);
}
isRefreshing = false;
}
public async void JoinAsync(Lobby lobby)
{
if (isJoining) { return; }
isJoining = true;
try
{
Lobby joiningLobby = await Lobbies.Instance.JoinLobbyByIdAsync(lobby.Id);
string joinCode = joiningLobby.Data["JoinCode"].Value;
await ClientSingleton.Instance.GameManager.StartClientAsync(joinCode);
}
catch (LobbyServiceException e)
{
Debug.Log(e);
}
isJoining = false;
}
}
LobbyItem
using System.Collections;
using System.Collections.Generic;
using TMPro;
using Unity.Services.Lobbies.Models;
using UnityEngine;
public class LobbyItem : MonoBehaviour
{
[SerializeField] private TMP_Text lobbyNameText;
[SerializeField] private TMP_Text lobbyPlayersText;
private LobbiesList lobbiesList;
private Lobby lobby;
public void Initialise(LobbiesList lobbiesList, Lobby lobby)
{
this.lobbiesList = lobbiesList;
this.lobby = lobby;
lobbyNameText.text = lobby.Name;
lobbyPlayersText.text = $"{lobby.Players.Count}/{lobby.MaxPlayers}";
}
public void Join()
{
lobbiesList.JoinAsync(lobby);
}
}
Please help.