0
\$\begingroup\$

I'm encountering an issue while using the NetworkDriver.Create method in Unity Networking and I could use some assistance.

Here's the code snippet where I'm facing the problem:

s_networkDriver = NetworkDriver.Create(new ReliableUtility.Parameters { WindowSize = 32 });

Whenever I run this line, I receive the following error:

error CS0315: The type 'Unity.Networking.Transport.Utilities.ReliableUtility.Parameters' cannot be used as type parameter 'N' in the generic type or method 'NetworkDriver.Create<N>(N)'. There is no boxing conversion from 'Unity.Networking.Transport.Utilities.ReliableUtility.Parameters' to 'Unity.Networking.Transport.INetworkInterface'.

I'm not entirely sure what this error means or how to resolve it. Can someone please provide some guidance on how to properly use NetworkDriver.Create in Unity Networking?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

There is no overload of NetworkDriver.Create() which expects the argument to be a ReliableUtility.Parameters value.

I haven't used the Transport package, but from some quick looking at the API docs, you probably need to do something like this:

NetworkDriver CreateDriver(Allocator allocator) {
    var settings = new NetworkSettings(allocator);
    settings.AddRawParameterStruct(new ReliableUtility.Parameters { WindowSize = 32 });
    var networkDriver = NetworkDriver.Create(settings);
    return networkDriver;
}

See also https://docs.unity3d.com/Packages/[email protected]/api/Unity.Networking.Transport.NetworkSettings.html

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .