Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetworkServer.AddPlayerForConnection method stopped working #3971

Closed
EnroGame opened this issue Jan 21, 2025 · 1 comment
Closed

NetworkServer.AddPlayerForConnection method stopped working #3971

EnroGame opened this issue Jan 21, 2025 · 1 comment

Comments

@EnroGame
Copy link

Describe the bug
I was using Mirror with FizzySteamworks and everything was working fine, but today when I launched the game the NetworkServer.AddPlayerForConnection method stopped working, causing the Lobby scene not to load. I needed this to bind the player object to the client connection and add it to the game on the server. Despite the fact that the game does not work correctly, there are no error messages or even warnings in the console

How can we reproduce the issue, step by step:

In the main loading scene, I added a new CustomNetworkManager.cs that inherits from NetworkManager, which stores an array of game objects, as well as overridden OnServerAddPlayer and OnServerDisconnect methods. In OnServerAddPlayer, I assign each connection a game object using the AddPlayerForConnection method.
When I create a new lobby using SteamMatchmaking.CreateLobby, I wait until the lobby is created and call the StartHost method, after which the Lobby scene should load and the OnServerAddPlayer method should work together with AddPlayerForConnection, however, when the Lobby scene starts, Unity freezes, the Lobby scene disappears. and the previous scene is marked. as (Not loaded).

Expected behavior
The Lobby scene should have loaded, and the game object that should have been created on startup should have received isOwned

Screenshots

Image
Image
Image

Desktop (please complete the following information):

  • OS: Windows 10
  • Build target: Windows
  • Unity version: 6000.0.34f1 and 2022.3.16f1
  • Mirror branch: Master: 93.0.1 from Asset Store

Additional context
The project was fully functional 2 days ago and I haven't changed anything in it all this time, and today the problem first appeared on Unity 2022.3.16f1, after which I tried the code on another project and it didn't work either, after which I installed Unity 6000.0.34f1, but the code didn't work correctly there either, and not a single error was displayed in the console.

@MrGadget1024
Copy link
Collaborator

While your setup is overkill and your override of OnServerAddPlayer isn't necessary, I'd say this was a steam issue, not a Mirror issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants