Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions com.unity.netcode.gameobjects/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ Additional documentation and release notes are available at [Multiplayer Documen

### Added

- Added a new variant of `UnityTransport.GetDefaultPipelineConfigurations` that takes a reference to the created `NetworkDriver`. This will register all pipeline stages that `UnityTransport` requires, removing the need to manually register them in your own custom driver constructor. (#3980)

### Changed

- `NetworkMetricsPipelineStage` is now defined even when the multiplayer tools package is not installed, removing the need to guard its registration behind a version define when using a custom driver in `UnityTransport`. (#3980)

### Deprecated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ namespace Unity.Netcode.Transports.UTP
/// var settings = transport.GetDefaultNetworkSettings();
/// driver = NetworkDriver.Create(new IPCNetworkInterface(), settings);
///
/// driver.RegisterPipelineStage(new NetworkMetricsPipelineStage());
///
/// transport.GetDefaultPipelineConfigurations(
/// ref driver,
/// out var unreliableFragmentedPipelineStages,
/// out var unreliableSequencedFragmentedPipelineStages,
/// out var reliableSequencedPipelineStages);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#if MULTIPLAYER_TOOLS
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
using AOT;
using Unity.Burst;
using Unity.Collections.LowLevel.Unsafe;
Expand Down Expand Up @@ -70,5 +68,3 @@ private static void InitializeConnection(byte* staticInstanceBuffer, int staticI
}
}
}
#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,23 @@ public void GetDefaultPipelineConfigurations(
reliableSequencedPipelineStages = new(reliableSequenced, Allocator.Temp);
}

/// <inheritdoc cref="GetDefaultPipelineConfigurations(out NativeArray{NetworkPipelineStageId}, out NativeArray{NetworkPipelineStageId}, out NativeArray{NetworkPipelineStageId})"/>
/// <param name="driver">Driver for which the pipeline configurations are being retrieved.</param>
public void GetDefaultPipelineConfigurations(
ref NetworkDriver driver,
out NativeArray<NetworkPipelineStageId> unreliableFragmentedPipelineStages,
out NativeArray<NetworkPipelineStageId> unreliableSequencedFragmentedPipelineStages,
out NativeArray<NetworkPipelineStageId> reliableSequencedPipelineStages)
{
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
driver.RegisterPipelineStage(new NetworkMetricsPipelineStage());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense for driver.RegisterPipelineStage to be defined with a conditional attribute?

[Conditional("MULTIPLAYER_TOOLS_1_0_0_PRE_7")]
void RegisterPipelineStage(NetworkMetricsPipelineStage pipelineStage)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would make sense. I don't know if it would make more sense. What are the advantages you see to using the Conditional attribute here?

#endif
GetDefaultPipelineConfigurations(
out unreliableFragmentedPipelineStages,
out unreliableSequencedFragmentedPipelineStages,
out reliableSequencedPipelineStages);
}

private NetworkPipeline SelectSendPipeline(NetworkDelivery delivery)
{
switch (delivery)
Expand Down Expand Up @@ -1860,11 +1877,8 @@ public void CreateDriver(
#endif
}

#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
driver.RegisterPipelineStage(new NetworkMetricsPipelineStage());
#endif

GetDefaultPipelineConfigurations(
ref driver,
out var unreliableFragmentedPipelineStages,
out var unreliableSequencedFragmentedPipelineStages,
out var reliableSequencedPipelineStages);
Expand Down
4 changes: 2 additions & 2 deletions com.unity.netcode.gameobjects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "com.unity.netcode.gameobjects",
"displayName": "Netcode for GameObjects",
"description": "Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.",
"version": "2.11.3",
"version": "2.12.0",
"unity": "6000.0",
"dependencies": {
"com.unity.nuget.mono-cecil": "1.11.4",
Expand All @@ -15,4 +15,4 @@
"path": "Samples~/Bootstrap"
}
]
}
}