Search Unity

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

Discussion in 'NetCode for ECS' started by Occuros, Mar 25, 2023.

  1. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    300
    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?
     
    ImproxGames likes this.
  2. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    894
    that seem really strange. especially if you add the define. Will check immediately
     
    Occuros likes this.
  3. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    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()
     
    Last edited: Mar 25, 2023
  4. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    300
    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.
     
    Last edited: Mar 26, 2023
  5. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    894
    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.

    Code (csharp):
    1.  
    2. private NetworkEndpoint SanitizeConnectAddress(in NetworkEndpoint endpoint, int driverId)
    3. {
    4. #if UNITY_CLIENT
    5.   return endpoint;
    6. #else
    7.   ...
    8. #endif
    9. }
    10.  
    Or call this function in NetworkStreamDriver only if UNITY_CLIENT is not set
    Code (csharp):
    1.  
    2. #if !UNITY_CLIENT
    3. endpoint = SanitizeConnectAddress(endpoint, DriverStore.FirstDriver);
    4. #endif
    5.  
    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.
     
    Last edited: Mar 26, 2023
    Occuros and optimise like this.
  6. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    894
    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
     
    Occuros likes this.
  7. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    300
    That worked!

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

    PlaysideCoreyS

    Joined:
    Sep 16, 2022
    Posts:
    4
    This fix is not working for us for a PC project. :(
    Is there a new preview version of the package near release?
     
  9. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    894
    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
     
  10. PlaysideCoreyS

    PlaysideCoreyS

    Joined:
    Sep 16, 2022
    Posts:
    4
    I'll give that a try. Thanks
     
  11. PlaysideCoreyS

    PlaysideCoreyS

    Joined:
    Sep 16, 2022
    Posts:
    4
    It connects but results in a console full of errors. We reverted to .47 until the next release.
     
    ImproxGames and agemodediz like this.
  12. ImproxGames

    ImproxGames

    Joined:
    Apr 3, 2017
    Posts:
    20
    @CMarastoni Would it be possible to get a .66 release that fixes this?
     
  13. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    894
    Netcode For Entities 1.0.8 is already out.