1.0.0-pre.65: Always builds Client/Server (on android platform)

Latest release has now a warning if you build client/server but try to connect not to the loopack address (which is great).

But it seems its impossible now to create a client:

  • Project Settings => NetCode Client Target is set to Client

Still always builds a Client/Server and the warning is shown (and it won’t connect to my server)

I even tried to define UNITY_CLIENT in the scripting define symbols but nothing helps to actually get a client.

Is there any workaround?

1 Like

that seem really strange. especially if you add the define. Will check immediately

1 Like

Yes. I believe I also get the same issue. Looks like the server world doesn’t bake into android build but the validation logic is buggy that falsely blocks the network connection as the following warning.

Edit: The root cause might caused by client server world baking issue that maybe there’s zombie server world instance I dunno. It seems like starting from pre.15 until recent pre.65, client server baking still buggy. But more importantly there’s no client server world editor authoring tooling yet. Does official still plan to ship this feature at 1.0 or after 1.0?

The requested playmode type is Client/Server but the client is trying to connect to address xxx:xxx that is not the loopback address. Forcing using the NetworkEndPoint.Loopback; family (IPV4/IPV6) and port will be preserved
Unity.NetCode.NetworkStreamDriver:SanitizeConnectAddress(NetworkEndpoint&, Int32)
Unity.NetCode.NetworkStreamDriver:Connect(EntityManager, NetworkEndpoint, Entity)
Scene_LoadClientGameSubSceneSystem:OnUpdate()
Unity.Entities.SystemBase:Update()
Unity.Entities.ComponentSystemGroup:UpdateAllSystems()
Unity.Entities.SystemBase:Update()
Unity.Entities.ComponentSystemGroup:UpdateAllSystems()
Unity.Entities.SystemBase:Update()

Thank you for validating it so fast.

If there is any workaround, which is probably unlikely as its the editor build process, it would be ideal, as currently we can’t test it on a real device and real networking conditions.

For 1.0 the support for that will not be available. It is currently planned for after 1.0.

Sorry for keep you waiting on this issue.

The problem is due to the fact the SharedStatic HasServerWorld is != 0…
But there is not one setting it.

The build is a ClientOnly one (verified and we have test for that too).

I don’t have a “proper” fix right now for it, but as work around for the build just modify the SanitizeConnectAddress to return the current endpoint if UNITY_CLIENT is set.

private NetworkEndpoint SanitizeConnectAddress(in NetworkEndpoint endpoint, int driverId)
{
#if UNITY_CLIENT
  return endpoint;
#else
  ...
#endif
}

Or call this function in NetworkStreamDriver only if UNITY_CLIENT is not set

#if !UNITY_CLIENT
endpoint = SanitizeConnectAddress(endpoint, DriverStore.FirstDriver);
#endif

That fix make sense in general, because if UNITY_CLIENT is set, IPC connection is not used so any address you pass should be considered as a potential valid one.

2 Likes

There is still a problem though: if the HasServerWorld !=0 we are clamping the max delta time on the Client based on the server batching settings. That we may not want to. But that is secondary right now

1 Like

That worked!

We can not create an andoid + linux server build and can connect.

This fix is not working for us for a PC project. :frowning:
Is there a new preview version of the package near release?

There were two problems and they have fixed for the next 1.0 release. I would sincerely just comment out the SanitizeConnectAddress in 1.0-pre.65

I’ll give that a try. Thanks

It connects but results in a console full of errors. We reverted to .47 until the next release.

2 Likes

@CMarastoni Would it be possible to get a .66 release that fixes this?

1 Like

Netcode For Entities 1.0.8 is already out.