#Leaving lobby breaks in build but not editor (Epic Online Services)

10 messages · Page 1 of 1 (latest)

sweet cloak
#

When i leave a lobby or stop hosting in editor, everything works fine.
When i leave or stop hosting in a build, EpicTransport dies and stops working entirely

here's the logs from the build

Transport shut down.
Unloading 7 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 1.724800 ms
Exception: Failed to initialize platform: AlreadyConfigured
  at EpicTransport.EOSSDKComponent.InitializeImplementation () [0x00075] in <a6f2c84c00c045bc99b78794ba4e18bb>:0 
  at EpicTransport.EOSSDKComponent.Initialize () [0x0001e] in <a6f2c84c00c045bc99b78794ba4e18bb>:0 
  at EpicTransport.EOSSDKComponent.Awake () [0x00086] in <a6f2c84c00c045bc99b78794ba4e18bb>:0 

NullReferenceException: Object reference not set to an instance of an object
  at EpicTransport.EOSSDKComponent.GetLobbyInterface () [0x00005] in <a6f2c84c00c045bc99b78794ba4e18bb>:0 
  at EOSLobby.Start () [0x0000a] in <a6f2c84c00c045bc99b78794ba4e18bb>:0 

NullReferenceException: Object reference not set to an instance of an object
  at EpicTransport.EOSSDKComponent.Tick () [0x00016] in <a6f2c84c00c045bc99b78794ba4e18bb>:0 
  at EpicTransport.EosTransport.ServerEarlyUpdate () [0x00000] in <a6f2c84c00c045bc99b78794ba4e18bb>:0 
  at Mirror.NetworkServer.NetworkEarlyUpdate () [0x00028] in <05fa8c520f4b413d9ddc072537a2ca66>:0 
  at Mirror.NetworkLoop.NetworkEarlyUpdate () [0x0000d] in <05fa8c520f4b413d9ddc072537a2ca66>:0 

and here's the leave lobby code

    public void LeaveLobby()
    {
        if (NetworkServer.active)
            NetworkManager.singleton.StopHost();
        else
            NetworkManager.singleton.StopClient();
    }

There's also this from the EosLobbyHud, not my code so not sure of its impact

    private void OnLeaveLobbySuccess()
    {
        //when the lobby was left successfully, stop the host/client
        manager.StopHost();
        manager.StopClient();
    }
#

oh, almost certainly very important
i'm calling this when i leave the lobby back to the main (non-multiplayer menu)

NetworkManager.ResetStatics();```
sweet cloak
#

ah this'll do it

#

split the EOSSDKComponent out from the rest of the game object so it stays undeleted.

acoustic lotus
sweet cloak
#

so i think the reason i'm doing this (project is old now and i've been cleaning it up somewhat) is that the offline scene isn't the main scene of the game.

and i've got some code that runs differently depending on whether you're in multiplayer or not. and the only way i currently know if youre in multiplayer is checking the network manager singleton.

#

i'll have a little lookey

#

because the offline scene isn't really an offline scene, its an online lobby browser, and the online scene is the lobby.

sweet cloak
#

so, a more specific example.
I'm currently doing this to enable multiplayer ui and disable single player ui

public class MultiplayerUIEnabler : MonoBehaviour
{
    [SerializeField] List<GameObject> hidableSinglePlayerUI = default;
    void Awake()
    {
        if (NetworkManager.singleton == null)
        {
            Destroy(gameObject);
            return;
        }
        hidableSinglePlayerUI.ForEach(x => x.SetActive(false));
    }
}