Problems with NetworkServer.Spawn(unitInstance, connectionToClient)

I get the error with the NetworkServer.Spawn that the name “Spawn” doesn’t exist in the current context, yet when I open NetworkServer I can clearly see the Spawn method and it’s overloads.

On top of that it appears that connectionToClient no longer exists by itself, I had the options for localConnectionToClient and networkConnectionToClient, can someone explain the difference in comparison to the original?

Thank you for your time and help

Hi There,

Sorry you are having trouble, what version of Unity/Mirror are you using?

The Spawn error, is this occurring at runtime, or is it being flagged by the code editor?

1 Like

Hy there,
I’m using MIrror 53.0.0 and Unity 2020.3.25f1

The Spawn() error is flagged as an error in the code editor, it will refuse to compile and thus run.

image

Even when typing ConnectToClient it was telling me do I mean the Local- or Network- ConnectToClient, as it does suggest now to replace it.

Again, thank you for your help.

Okay sudden developments here, Spawn wasn’t recognized outside the [Command] method, inside it works! My fault there, didn’t check everything properly.
Still, overall it doesn’t work due to the ConnectToClient being split to LocalConnectToClient and NetworkConnectToClient. What is the difference between them?

1 Like

Okay so I wrote ConnectionToClient but I had to write connectionToClient. Some mistakes that really look silly in retrospect. I was probably too tired when I was doing it and didn’t catch the obvious.

1 Like

Glad you figured it out!

1 Like

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

Privacy & Terms