JsonSerializationException: Required property 'ip' not found in JSON. Path '', line 8, position 1.

When trying to allocate a server from my script I’m faced with this error and for some reason it returns null when I try to read the ServerConfig. This is the script please help.

public class MatchmakerServer : MonoBehaviour
{

public event Action? OnServerStart;

async void Start()
{
OnServerStart += MatchmakerManager_OnServerStart;

await UnityServices.InitializeAsync();

StartCoroutine(StartServer());
}
async Awaitable StartServer()
{
var Server = MultiplayService.Instance.ServerConfig.ToString();

Debug.Log($“Server: {Server}”);

var transport = NetworkManager.Singleton.GetComponent();

Debug.Log("Network Address: " + transport.ConnectionData.Address + "Network Port: " + transport.ConnectionData.Port);

OnServerStart.Invoke();

var callbacks = new MultiplayEventCallbacks();

callbacks.Allocate += Callbacks_Allocate;

callbacks.Deallocate += Callbacks_Deallocate;

callbacks.Error += Callbacks_Error;

while (MultiplayService.Instance == null)
{
await Awaitable.NextFrameAsync();
}

}

private void Callbacks_Error(MultiplayError obj)
{
Debug.LogError(“Multipllay Service Callback error”);
}

private async void Callbacks_Deallocate(MultiplayDeallocation obj)
{
Debug.Log($“Service Deallocating:{obj}”);

await MultiplayService.Instance.UnreadyServerAsync();
}

private async void Callbacks_Allocate(MultiplayAllocation obj)
{
Debug.Log($“Servive Allocating: {obj}”);

await MultiplayService.Instance.ReadyServerForPlayersAsync();
}

private void MatchmakerManager_OnServerStart()
{
NetworkManager.Singleton.SceneManager.LoadScene(“Main Project”, LoadSceneMode.Single);
}
}

1 Like

I’m having the same problem when writing anything with “MultiplayService.Instance”. Is there anything I have to do before hand?