#InvalidOperationException: Too many NetworkDriver created for the client. Only one NetworkDriver ...

1 messages · Page 1 of 1 (latest)

slender saddle
#

I'm getting slowly into ecs.

Using ecs 1.2.pre6 i'm getting an error with netcode : InvalidOperationException: Too many NetworkDriver created for the client. Only one NetworkDriver instance should exist

With the code up there.

Any idea as to wy ?

restive river
#

why do you manage worlds creation in some go instead of bootstrap workflow?
you will have better control about which worlds will be created if you will do this in bootstrap because it runs before any go and probably already creates some worlds for you

#

check your project and find ClientServerBootstrap implementation (or ICustomBootstrap) and customize your worlds creation from it
also allow worlds to manage theirs connections from inside, i.e. ConnectSystem to handle when and where to connect

#

you can read my bootstrap - it basically do nothing except creating worlds, skipping the default one


[UnityEngine.Scripting.Preserve]
public class NetCodeBootstrap : ClientServerBootstrap {

    public override bool Initialize(string defaultWorldName) {
        //CreateLocalWorld(defaultWorldName);

        bool autoStartServer = ManagedUtil.GetArgument("auto-server") == "1";
#if UNITY_EDITOR
        autoStartServer = true;
#endif
        if (autoStartServer) {
            UnityEngine.Debug.Log("Server auto-start enabled");
            CreateServerWorld("ServerWorld");
        }

        bool autoStartClient = ManagedUtil.GetArgument("auto-client") == "1";
#if UNITY_EDITOR
        autoStartClient = true;
#endif
        if (autoStartClient) {
            UnityEngine.Debug.Log("Client auto-start enabled");
            CreateClientWorld("ClientWorld");
        }
        return true;
    }
}```