Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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:
    1,008
    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.