question

jooglier4 avatar image
jooglier4 asked

My network scene in Unity only loads when server is on standby

Hey, I'm using Unity, ApathyTransport and Playfab for server stuff. I have an offline scene that automatically tries to connect clients to the server. When the server is startet it loads a network scene for all clients, that means, every client which connects to the server should automatically load the server scene. BUT, when I try to connect as client to my server and the server is active, I connect but my server scene is not loaded. My server scene is only loaded when the server is on standby. This is the first weird thing. The second weird thing is, that when the server is on standby and I connect with a client (Server scene is loaded), my client gets shutted down after a certain amount of time... don't know why... what am I missing? Any help?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Made Wang avatar image
Made Wang answered

>>when I try to connect as client to my server and the server is active, I connect but my server scene is not loaded. My server scene is only loaded when the server is on standby.

It's up to you to check the order in which the code runs when you connect to the server, and whether the code to load the scene is executed correctly. But first make sure you're connected to the server.

>>The second weird thing is, that when the server is on standby and I connect with a client (Server scene is loaded), my client gets shutted down after a certain amount of time

If you didn't exit the server application yourself, then you can add an event in GameserverSDK.RegisterShutdownCallback to output the log when the server shuts down, refer to Integrating game servers with the PlayFab Game Server SDK (GSDK) - PlayFab | Microsoft Docs. You can view log files in Multiplayer->Servers->[Build]->Servers->Archived Servers.

Another thing to clarify is that the Standby server should become Active when you request the server, and then allow players to connect to the server. And you can see the specific status of the server and the players in it in Multiplayer->Servers->[Build]->Servers.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jooglier4 avatar image jooglier4 commented ·

>> Another thing to clarify is that the Standby server should become Active when you request the server, and then allow players to connect to the server. And you can see the specific status of the server and the players in it in Multiplayer->Servers->[Build]->Servers.

I mean the client only requests the server when I want to get the port and ip. Then I use port and ip to connect to the server without requesting it. Or is this approach wrong? And should the server stay active forever? So if I try to connect to a standby server with port and ip the server is not going to be active. What about this? (I'm completely new to playfab as you can see and thanks for your answer)

0 Likes 0 ·
Made Wang avatar image Made Wang jooglier4 commented ·

There is no need to request every time, the request to the server is to assign the server IP and port and convert the server to Active. So, if the server is already Active, you can just use the corresponding IP and port to connect. But for a standby server, you should first request the server to convert the server to Active and then use the returned IP and port to connect.

The server doesn't stay Active forever and shouldn't be, usually the server is shut down when the server application process exits.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.