Auto disconnected from local server

Options
I am using Photon Bolt version 1.2.4 in my Unity project which version is 2018.3.0f2. When client connected to local server, after a few seconds, it auto disconnected. I wonder to know where am I wrong?

Here is steps on how to show the problem:

1:Create new project, and import “Photon Bolt FREE.unitypackage”.

2:Create new scene, attach “Menu.cs” to MainCamera game object. Name it as “Menu”, add it to build setting.

3:Create new scene, name it as “OnlineScene”. Add it to build settings.

4:Compile Assembly.

5:Build the project.

6:Run it. Press S to start server.

7:Run another instance, Press C to connect the server as client.

8:Wait for a few seconds. It auto disconnect.

Here is "Menu.cs":

using Bolt;
using UdpKit;
using UnityEngine;

public class Menu : GlobalEventListener
{
private void Update()
{
if (Input.GetKeyDown(KeyCode.S))
{
BoltLauncher.StartServer(UdpEndPoint.Parse("127.0.0.1:27000"));
}

if (Input.GetKeyDown(KeyCode.C))
{
BoltLauncher.StartClient();
}
}

public override void BoltStartDone()
{
if (BoltNetwork.IsServer)
{
BoltNetwork.LoadScene("OnlineScene");
}
else
{
BoltNetwork.Connect(27000);
}
}
}

Comments

  • stanchion
    Options

    As you are using Bolt Free, you will not be able to connect directly the peers using their IP:PORT, instead you need to create a Photon Session on the Server, and then connect to it on the Client. You can use an existing Menu script that we pack into the Samples package, that has a good starting point to this case.

    Please, take a look at this file, so you can have a better idea: https://github.com/BoltEngine/Bolt-Sample/blob/master/BoltInit.cs