Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice
  3. Improve your project's performance with our new guide on profiling in Unity.
    Dismiss Notice

Feedback (Unity Transport) Make more overloadings for NetworkDriver.GetPipelineBuffers()

Discussion in 'Unity Transport' started by Kichang-Kim, Sep 19, 2019.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    807
    Hi, I have some feedback about GenericNetworkDriver.GetPipelineBuffers(), in Unity Transport library.

    Currently, it has two types of overloading:
    Code (CSharp):
    1. public void GetPipelineBuffers(Type pipelineType, NetworkConnection connection, ref NativeSlice<byte> readProcessingBuffer, ref NativeSlice<byte> writeProcessingBuffer, ref NativeSlice<byte> sharedBuffer);
    2. public void GetPipelineBuffers(NetworkPipeline pipeline, int stageId, NetworkConnection connection, ref NativeSlice<byte> readProcessingBuffer, ref NativeSlice<byte> writeProcessingBuffer, ref NativeSlice<byte> sharedBuffer);
    The problem is that, first type of overload makes error when you using multiple multi-stage pipelines. If you trying to getting the buffer of specific stage type, it throws stageId not found exception.

    So your choice is only second overload. But second thing requires specified stageId which is defined on your stage collection struct. Even INetworkPipelineStageCollection has GetStageId() method, you can't access your driver's INetworkPipelineStageCollection instance. So you should manually create dummy INetworkPipelineStageCollection instance and call its GetStageId method. I think that this is clearly redundant, and GenericNetworkDriver should provide more straight overload, like this:
    Code (CSharp):
    1. public void GetPipelineBuffers(NetworkPipeline pipeline, Type stageType, NetworkConnection connection, ref NativeSlice<byte> readProcessingBuffer, ref NativeSlice<byte> writeProcessingBuffer, ref NativeSlice<byte> sharedBuffer);
    Thanks.
     
unityunity