Search Unity

Unity NetCode 0.0.2-preview.1

Discussion in 'NetCode for ECS' started by timjohansson, Nov 29, 2019.

  1. dwatt-hollowworldgames

    dwatt-hollowworldgames

    Joined:
    Apr 26, 2019
    Posts:
    104
    cool that worked ty
     
  2. MMOERPG

    MMOERPG

    Joined:
    Mar 21, 2014
    Posts:
    50
    My build is not connecting. Is port forwarding required for testing on a single machine with server/client running on editor and second client running from the build?
    I'm using the default NetworkEndPoint.LoopbackIpv4
     
  3. pocketpair

    pocketpair

    Joined:
    Jul 7, 2015
    Posts:
    72
    @timjohansson
    Hi, thank you for your reply, how about recent official way to stop server?
    I tried some options as below, but I'm not sure what option is best for us.

    Code (CSharp):
    1.  
    2. var network = OcNetMng.Inst.WorldServer.GetExistingSystem<NetworkStreamReceiveSystem>();
    3.  
    4. // Option 1
    5. network.Enabled = false;
    6.  
    7. // Option 2
    8. network.Driver.Dispose();
    9.  
    10.  
    11. var streamCon = network.GetSingleton<NetworkStreamConnection>();
    12.  
    13. // Option 3
    14. network.Driver.Disconnect(streamCon.Value);
     
  4. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    Just disposing the server work should work as of netcode 0.1.0. If you want to disconnect all clients without destroying the world the supported way would be to iterate over all connection entities and add NetworkStreamRequestDisconnect to them.
     
    bb8_1 likes this.
  5. pocketpair

    pocketpair

    Joined:
    Jul 7, 2015
    Posts:
    72
    bb8_1 likes this.
  6. LevonVH

    LevonVH

    Joined:
    Dec 16, 2016
    Posts:
    19
    I have implemented the net-cube example in the docs. When I run it with the "Client & Server" option of multiplayer tools, all works fine. But when I run it with the "Server" option, I continuously get the warning "Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak".
    Does anyone have a clue on this?
     
    Last edited: Nov 10, 2020
  7. kanesteven

    kanesteven

    Joined:
    Aug 30, 2018
    Posts:
    45
    @I_Mariachi_I I believe this is an issue caused by some internally allocated native containers ( with lifetime ~4 frames thanks to Allocator.TempJob ) living too long because the framerate is unbounded. I believe that you can solve this in the editor by enabling VSynce in your game view's drop down:

    upload_2020-11-10_14-30-56.png

    Additionally, I think you may want to try setting Application.TargetFramerate = 60 in your initialization code.

    Finally, this is a very old thread for netcode. You may get better luck if you post in the more recent 0.4.0 thread.
     
    LevonVH likes this.
  8. LevonVH

    LevonVH

    Joined:
    Dec 16, 2016
    Posts:
    19
    Thanks for the answer kanesteven. It solved it for me :)
     
    kanesteven likes this.