Unity MultiPlayer - no active transport when calling NetworkServer.Listen

I’ve seen a few other people ask around about the same topic, but their solutions aren’t working for me.
I’ve been at this for about 12hrs and haven’t been able to find the solution.

First problem:
Using the video’s code:

public override void OnClientConnect(NetworkConnection conn)
{
base.OnClientConnect(conn);
Debug.Log (“Message here”);
{

The script states that the phrase: OnClientConnect(NetworkConnection conn) is obsolete.
Going through the documentation for the script, it has been replaced with the phrase:
public override void OnClientConnect()

So, my new code being:
public override void OnClientConnect()
{
base.OnClientConnect();
Debug.Log (“Message here”);
{

Throws an error of:
There was no active transport when calling NetworkServer.Listen, If you are calling Listen manually then make sure to set ‘Transport.activeTransport’ first

I tried the whole day where to fill in the ‘Transport.activeTransport’ but I’ve not been able to. I am completely stuck in the course.

1 Like

Hi there, sorry you are having trouble. I think you are on the right path.

To get the transport set up, you need to attach a transport component to the RTSNetworkManager prefab. Then drag that component into the transport field on the network manager component.


Let me know if that helps.

2 Likes

This did solve it, oh my lord. I was 100% convinced it was a scripting issue because the log kept throwing me into the script prompting code.

In future, is there a way to tell whether it’s going to be referencing the unity side of things or scripting?
thank you again, seriously!

A lot of telling if it is a scripting or editor issue is from experience. Having seen this error before, I knew it was in the editor.

In this case, since we don’t really handle the transport in our code, I would start with checking the scene setup. We know Mirror is handling the transport in it’s code, so begin with the assumption that code is correct.

Remember the console will tell where the error is in code, but it won’t tell you how to fix it. For example, I often get null reference errors, sometimes these are me forgetting to set something in script, but often these are me forgetting to set something in the editor as well. A good strategy would to be first to check the code where the error occurs. If you don’t see anything obvious there, then see if those Objects are exposed in the scene and can be fixed there.

2 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms