BoltEngine / Bolt-Tracker

New issue tracker for Photon Bolt
10 stars 2 forks source link

Debug Start with Editor as Client does not load Scene correctly #166

Closed mariuskilian closed 4 years ago

mariuskilian commented 4 years ago

Describe the bug Hello, I had a little problem when using Bolt Scene Debug Start and running my Editor as the Client, where the editor would have loaded as a client before the Server was up, which would cause a Connection error. It would try to reconnect until the Server was up, and would eventually connect, but then wouldn't load the Scene properly and just keep being on the "Your Scene is being Loaded..." screen. I hotfixed it by changing the following code inside 'BoltDebugStart.cs':

public override void BoltStartDone()
{
    if (BoltNetwork.IsServer || BoltNetwork.IsSinglePlayer)
    {
        BoltNetwork.LoadScene(BoltRuntimeSettings.instance.debugStartMapName);
    }
    else if (BoltNetwork.IsClient)
    {
        BoltNetwork.Connect((ushort)BoltRuntimeSettings.instance.debugStartPort);
    }
}

to this:

public override void BoltStartDone()
{
    if (BoltNetwork.IsServer || BoltNetwork.IsSinglePlayer)
    {
        BoltNetwork.LoadScene(BoltRuntimeSettings.instance.debugStartMapName);
    }
    else if (BoltNetwork.IsClient)
    {
        StartCoroutine(WaitThenStartClient());
    }
}
private IEnumerator WaitThenStartClient()
{
    yield return new WaitForSeconds(5);
    BoltNetwork.Connect((ushort)BoltRuntimeSettings.instance.debugStartPort);
}

This makes it only try to load into the server after it's already up, causing a normal connection and scene load. Before this change, Bolt would not display any error message besides the normal

then a short series of

which eventually ended in

At which point the Scene just wouldn't load, as described above. I hope this is enough information.

To Reproduce Steps to reproduce the behavior:

  1. Go to the Menu 'Bolt/Scenes'
  2. Set 'Editor Mode' to 'Client'
  3. Set 'Clients' to something >= 1
  4. Click on 'Debug Start'
  5. See Error

Expected behavior A seperate window should open as the server and the Editor should connect as a client, both loading the scene correctly.

Actual behavior A seperate window opens as the server, the Editor runs as a Client and (after a few "ConnectionReset"s) connects to the server as a client, but the Scene doesn't load on the editor. _Note: On the Server, as well as any other client that is run as an external window, the scene loads correctly. Only the Editor as a client does not load the scene._

Screenshots Top row: Server window, Client window Bottom row: Client editor, Client window image

Desktop (If applicable, please complete the following information):

Additional context

ramonmelo commented 4 years ago

Fixed on the next release.

Thanks for your feedback.