Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,11 @@ private void DisplayNetworkManagerProperties()
}
}
var networkPrefabs = m_NetworkManager.NetworkConfig.MigrateOldNetworkPrefabsToNetworkPrefabsList();
#if UNITY_6000_2_OR_NEWER
string path = Path.Combine(directory, $"NetworkPrefabs-{m_NetworkManager.GetEntityId()}.asset");
#else
string path = Path.Combine(directory, $"NetworkPrefabs-{m_NetworkManager.GetInstanceID()}.asset");
#endif
Debug.Log("Saving migrated Network Prefabs List to " + path);
AssetDatabase.CreateAsset(networkPrefabs, path);
EditorUtility.SetDirty(m_NetworkManager);
Expand Down Expand Up @@ -390,7 +394,8 @@ public override void OnInspectorGUI()
#if !MULTIPLAYER_TOOLS
DrawInstallMultiplayerToolsTip();
#endif
void SetExpanded(bool expanded) { networkManager.NetworkManagerExpanded = expanded; };
void SetExpanded(bool expanded) { networkManager.NetworkManagerExpanded = expanded; }
;
DrawFoldOutGroup<NetworkManager>(networkManager.GetType(), DisplayNetworkManagerProperties, networkManager.NetworkManagerExpanded, SetExpanded);
DisplayCallToActionButtons();
base.OnInspectorGUI();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ public void RegisterHandler(IContactEventHandler contactEventHandler, bool regis
{
return;
}
#if UNITY_6000_2_OR_NEWER
var instanceId = rigidbody.GetEntityId();
#else
var instanceId = rigidbody.GetInstanceID();
#endif
if (register)
{
if (!m_RigidbodyMapping.ContainsKey(instanceId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,11 @@ private void InitDriver()
out m_UnreliableFragmentedPipeline,
out m_UnreliableSequencedFragmentedPipeline,
out m_ReliableSequencedPipeline);

#if UNITY_6000_2_OR_NEWER
TransportInitialized?.Invoke(GetEntityId(), m_Driver);
#else
TransportInitialized?.Invoke(GetInstanceID(), m_Driver);
#endif
}

private void DisposeInternals()
Expand All @@ -446,7 +449,11 @@ private void DisposeInternals()

m_SendQueue.Clear();

#if UNITY_6000_2_OR_NEWER
TransportDisposed?.Invoke(GetEntityId());
#else
TransportDisposed?.Invoke(GetInstanceID());
#endif
}

/// <summary>
Expand Down Expand Up @@ -496,14 +503,11 @@ public NetworkSettings GetDefaultNetworkSettings()
// Latency, jitter and packet loss will be set by the network simulator in the tools
// package. We just need to initialize the settings since otherwise these features will
// not be enabled at all in the driver.
settings.WithSimulatorStageParameters(
// Assuming a maximum average latency of 50 ms, and that we're somehow able to flush
// an entire reliable window every tick, then at 60 ticks per second we need to be
// able to store 60 * 0.05 * 64 = 192 packets per connection in the simulator
// pipeline stage. Double that since we handle both directions and round it up, and
// that's how we get 400 here.
maxPacketCount: 400,
randomSeed: DebugSimulatorRandomSeed ?? (uint)System.Diagnostics.Stopwatch.GetTimestamp());
// Assuming a maximum average latency of 50 ms, and that we're somehow able to flush an entire reliable window every tick,
// then at 60 ticks per second we need to be able to store 60 * 0.05 * 64 = 192 packets per connection in the simulator
// pipeline stage. Double that since we handle both directions and round it up, and
// that's how we get 400 here.
settings.WithSimulatorStageParameters(maxPacketCount: 400, randomSeed: DebugSimulatorRandomSeed ?? (uint)System.Diagnostics.Stopwatch.GetTimestamp());
settings.WithNetworkSimulatorParameters();
#endif

Expand Down Expand Up @@ -1100,15 +1104,18 @@ private void ExtractNetworkMetrics()
{
if (m_NetworkManager.IsServer)
{
for (int i=0; i<m_NetworkManager.ConnectedClientsIds.Count; ++i)
for (int i = 0; i < m_NetworkManager.ConnectedClientsIds.Count; ++i)
{
var ngoConnectionId = m_NetworkManager.ConnectedClientsIds[i];
var ngoConnectionId = m_NetworkManager.ConnectedClientsIds[i];
if (ngoConnectionId == 0 && m_NetworkManager.IsHost)
{
continue;
}
var transportClientId = m_NetworkManager.ConnectionManager.ClientIdToTransportId(ngoConnectionId);
ExtractNetworkMetricsForClient(transportClientId);
var transportClientIdReturn = m_NetworkManager.ConnectionManager.ClientIdToTransportId(ngoConnectionId);
if (transportClientIdReturn.Item2)
{
ExtractNetworkMetricsForClient(transportClientIdReturn.Item1);
}
}
}
else
Expand Down
23 changes: 12 additions & 11 deletions testproject/Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"disableProjectUpdate": false,
"dependencies": {
"com.unity.addressables": "2.2.2",
"com.unity.ai.navigation": "2.0.5",
"com.unity.collab-proxy": "2.6.0",
"com.unity.ide.rider": "3.0.31",
"com.unity.ide.visualstudio": "2.0.22",
"com.unity.mathematics": "1.3.2",
"com.unity.addressables": "2.7.4",
"com.unity.ai.navigation": "2.0.9",
"com.unity.collab-proxy": "2.9.3",
"com.unity.ide.rider": "3.0.38",
"com.unity.ide.visualstudio": "2.0.25",
"com.unity.mathematics": "1.3.3",
"com.unity.multiplayer.tools": "2.2.6",
"com.unity.netcode.gameobjects": "file:../../com.unity.netcode.gameobjects",
"com.unity.package-validation-suite": "0.49.0-preview",
"com.unity.services.authentication": "3.4.0",
"com.unity.services.core": "1.14.0",
"com.unity.test-framework": "1.4.6",
"com.unity.test-framework.performance": "3.0.3",
"com.unity.timeline": "1.8.7",
"com.unity.services.authentication": "3.5.2",
"com.unity.services.multiplayer": "1.1.8",
"com.unity.test-framework": "1.6.0",
"com.unity.test-framework.performance": "3.1.0",
"com.unity.timeline": "1.8.9",
"com.unity.ugui": "2.0.0",
"com.unity.modules.accessibility": "1.0.0",
"com.unity.modules.ai": "1.0.0",
Expand Down
Loading
Loading