Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [2.2.0] - 2024-07-24

### *General*
- Changed Window Menu location to Window/Multiplayer
- Activated the Hierarchy Network Debug View (Hierarchy overlay indicating NetworkObjects and ownership)

### *Network Scene Visualization*
- Fixed an issue where the console was spammed with errors when disconnecting from NGO.

### *Network Simulator*
- Fixed NullRef in Sample Scenario ConnectionParametersWithCurves

### *Runtime Net Stats Monitor*
- Fixed an issue throwing UI Layout errors when changing RNSM position
  • Loading branch information
Unity Technologies committed Jul 24, 2024
1 parent 6cb025d commit 49bf93d
Show file tree
Hide file tree
Showing 74 changed files with 1,060 additions and 176 deletions.
2 changes: 1 addition & 1 deletion .buginfo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
system: jira
server: jira.unity3d.com
project: MTL
project: MTTB
issuetype: Bug
package: Multiplayer Tools
1 change: 1 addition & 0 deletions .signature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"timestamp":1721939627,"signature":"U5yTOLFFav/nLjgpXYZB5IjdTT9Cs/whhU+Qqa0jSXqWzcJRjm3spN4yPMsYL3+KceHuAeeF+Cs+wkUyQeP3uCGt/jWSKh2fBoiMPxOtEs+d8gqyJcDO1GU5noTubKvOlUekH3inxxymmnbLxoQ8DoKRD/CbWXMWuBq5pWB6K/49yPPH3KZwPEtXO3f+GATFFVMPNl+RWTwN1XMBWdZDDZxGf1A++a5k4quIXmTdWi251ny8xcODV5lAoChaodIAnF400macTJfKaoajgg+aq66SjUGL5flRe2G7PGLAw+aDs5P9DguAXFde29HL/myZ2Yxg7VAY7zyLyNP8zwqbBR1IOoiR4dinYVcXL0TzDRQK7bRCGMupieNW18t4YYZ22OQbj/2WI0Eku398kgfQ97UO2ukXVlWQh6gMC4B7vBT6wcNorNx6VXJROEnjKTnP8bWa7AQLAy1wZZpBl7Cz59RPjc6viqYHhp2ZLJvXQJCW29xG5PJJaT2jtoiy/oYW","publicKey":"LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQm9qQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FZOEFNSUlCaWdLQ0FZRUFzdUhXYUhsZ0I1cVF4ZEJjTlJKSAordHR4SmoxcVY1NTdvMlZaRE1XaXhYRVBkRTBEMVFkT1JIRXNSS1RscmplUXlERU83ZlNQS0ZwZ1A3MU5TTnJCCkFHM2NFSU45aHNQVDhOVmllZmdWem5QTkVMenFkVmdEbFhpb2VpUnV6OERKWFgvblpmU1JWKytwbk9ySTRibG4KS0twelJlNW14OTc1SjhxZ1FvRktKT0NNRlpHdkJMR2MxSzZZaEIzOHJFODZCZzgzbUovWjBEYkVmQjBxZm13cgo2ZDVFUXFsd0E5Y3JZT1YyV1VpWXprSnBLNmJZNzRZNmM1TmpBcEFKeGNiaTFOaDlRVEhUcU44N0ZtMDF0R1ZwCjVNd1pXSWZuYVRUemEvTGZLelR5U0pka0tldEZMVGdkYXpMYlpzUEE2aHBSK0FJRTJhc0tLTi84UUk1N3UzU2cKL2xyMnZKS1IvU2l5eEN1Q20vQWJkYnJMbXk0WjlSdm1jMGdpclA4T0lLQWxBRWZ2TzV5Z2hSKy8vd1RpTFlzUQp1SllDM0V2UE16ZGdKUzdGR2FscnFLZzlPTCsxVzROY05yNWdveVdSUUJ0cktKaWlTZEJVWmVxb0RvSUY5NHpCCndGbzJJT1JFdXFqcU51M3diMWZIM3p1dGdtalFra3IxVjJhd3hmcExLWlROQWdNQkFBRT0KLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg"}
10 changes: 10 additions & 0 deletions Adapters/Components/Events/IGetConnectionStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;

namespace Unity.Multiplayer.Tools.Adapters
{
interface IGetConnectionStatus : IAdapterComponent
{
event Action ServerOrClientStarted;
event Action ServerOrClientStopped;
}
}
3 changes: 3 additions & 0 deletions Adapters/Components/Events/IGetConnectionStatus.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Adapters/MockNgo/MockNetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ void OnDestroy()
[field:SerializeField]
public int RotationUpdateByteCount { get; set; } = Constants.k_DefaultRotationChangeByteCount;

/// <summary>
/// The number of bytes of network traffic incurred when an object's scale changes.
/// </summary>
[field:Min(0)]
[field:SerializeField]
public int ScaleUpdateByteCount { get; set; } = Constants.k_DefaultScaleChangeByteCount;
Expand Down
17 changes: 17 additions & 0 deletions Adapters/MockNgo/MockNetworkObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@

namespace Unity.Multiplayer.Tools.Adapters.MockNgo
{
/// <summary>
/// A mock network object
/// </summary>
[AddComponentMenu("MP Tools Dev/" + nameof(MockNetworkObject), 1000)]
public class MockNetworkObject : MonoBehaviour
{
// Public properties
// --------------------------------------------------------------------
/// <summary>
/// The Owner client id
/// </summary>
[field:SerializeField]
public int OwnerClientId { get; set; }

Expand All @@ -17,6 +23,9 @@ ClientId Owner
set => OwnerClientId = (int)value;
}

/// <summary>
/// The Object id
/// </summary>
public int ObjectId { get; private set; } = -1;

// Cached references
Expand All @@ -38,11 +47,19 @@ ClientId PreviousOwner

// Methods to record network traffic
// --------------------------------------------------------------------
/// <summary>
/// Record bytes from a RPC call
/// </summary>
/// <param name="byteCount">The number of bytes to record</param>
public void RecordRpcCall(int byteCount)
{
Adapter.RecordRpcCall((ObjectId)ObjectId, byteCount);
}

/// <summary>
/// Record bytes from a NetworkVariable update
/// </summary>
/// <param name="byteCount">The number of bytes to record</param>
public void RecordNetworkVariableUpdate(int byteCount)
{
Adapter.RecordNetworkVariableUpdate((ObjectId)ObjectId, byteCount);
Expand Down
33 changes: 27 additions & 6 deletions Adapters/Ngo1/Ngo1Adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Ngo1Adapter
// --------------------------------------------------------------------
, IGetConnectedClients
, IMetricCollectionEvent
, IGetConnectionStatus

// Queries
// --------------------------------------------------------------------
Expand All @@ -41,12 +42,22 @@ public Ngo1Adapter([NotNull] NetworkManager networkManager)
DebugUtil.TraceMethodName();

Debug.Assert(networkManager != null, $"The parameter {nameof(networkManager)} can't be null.");

m_NetworkManager = networkManager;
m_NetworkManager.OnClientConnectedCallback += OnClientConnected;
m_NetworkManager.OnClientDisconnectCallback += OnClientDisconnected;
m_NetworkManager.NetworkTickSystem.Tick += OnTick;

m_NetworkManager.OnServerStarted += OnServerOrClientStarted;
m_NetworkManager.OnClientStarted += OnServerOrClientStarted;
m_NetworkManager.OnServerStopped += OnServerOrClientStopped;
m_NetworkManager.OnClientStopped += OnServerOrClientStopped;

if (m_NetworkManager.IsConnectedClient || m_NetworkManager.IsServer)
{
OnServerOrClientStarted();
}

MetricEventPublisher.OnMetricsReceived += OnMetricsReceived;
}

Expand Down Expand Up @@ -132,12 +143,26 @@ void OnClientConnected(ulong clientId)
}

public event Action<ClientId> ClientDisconnectionEvent;

void OnClientDisconnected(ulong clientId)
{
var typedClientId = (ClientId)clientId;
m_ClientIds.RemoveAll(id => id == typedClientId);
ClientDisconnectionEvent?.Invoke(typedClientId);
}

public event Action ServerOrClientStarted;
public event Action ServerOrClientStopped;

void OnServerOrClientStarted()
{
ServerOrClientStarted?.Invoke();
}

void OnServerOrClientStopped(bool isHost)
{
ServerOrClientStopped?.Invoke();
}

public event Action<MetricCollection> MetricCollectionEvent;
void OnMetricsReceived(MetricCollection metricCollection)
Expand All @@ -156,11 +181,7 @@ void OnMetricsReceived(MetricCollection metricCollection)
public GameObject GetGameObject(ObjectId objectId)
{
var spawnedObjects = SpawnedObjects;
if (spawnedObjects.TryGetValue((ulong)objectId, out var networkObject))
{
return networkObject.gameObject;
}
return null;
return spawnedObjects.TryGetValue((ulong)objectId, out var networkObject) ? networkObject.gameObject : null;
}

public ClientId GetOwner(ObjectId objectId)
Expand Down
160 changes: 160 additions & 0 deletions CHANGELOG.future.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Changelog
All notable changes to this package will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.2.0] - 2024-07-24

### *General*
- Changed Window Menu location to Window/Multiplayer
- Activated the Hierarchy Network Debug View (Hierarchy overlay indicating NetworkObjects and ownership)

### *Network Scene Visualization*
- Fixed an issue where the console was spammed with errors when disconnecting from NGO.

### *Network Simulator*
- Fixed NullRef in Sample Scenario ConnectionParametersWithCurves

### *Runtime Net Stats Monitor*
- Fixed an issue throwing UI Layout errors when changing RNSM position

## [2.1.0] - 2023-11-21

### *General*
- Increased minimum version to 2023.3+

### *Network Simulator*
- Fixed an issue with execution order dependend initialization of NetworkAdapters.

### *Network Scene Visualization*
- Improved usability when pausing the editor.

## [2.0.0-pre.5] - 2023-09-19

### *General*
- *New*: Find all the multiplayer tools in a central place in the multiplayer tools window.

### *Network Profiler*
- Fixed an issue causing inconsistent foldout behavior.
- Fixed a bug where switching frames would reset the sorting filter.
- Improved UI for the Network Profiler.

### *Runtime Net Stats Monitor*
- Fix an index out of range exception that could occur when adding a new RNSM graph at runtime.
- Renamed the Component in the "Add Component" menu from "RuntimeNetStatsMonitor" to "Runtime Network Stats Monitor".

### *Network Simulator*
- Added presets for common home broadband connections and situations.

### *Network Scene Visualization*
- Text Overlays now also work in 2D scenes with 2D colliders.
- Removed slight delay between bandwidth text and color change.
- Made bandwidth update instantly after switching back from Ownership mode

## [2.0.0-pre.3] - 2023-05-23

### *General*
- Remove unintentionally public classes (such as test classes), most of which were already deprecated.

### *Network Scene Visualization*
- Fix to prevent NGO from throwing a NotServerException when visualizing ownership on a client that is not connected as the server or host.

## [2.0.0-pre.2] - 2023-05-01

### *General*
- Dropped support for Unity 2020.3; the next supported version is Unity 2021.3
- Fixed ``Failed to load type initialization for assembly Unity.Multiplayer.Tools.MetricTypes`` runtime exception when building using Managed Stripping level set to high.

### *Network Scene Visualization*

This release adds the Network Scene Visualization to the Multiplayer Tools Package. This tool allows users to visualize networking information (like bandwidth and ownership) on a per-object basis in the scene view using a number of visualizations, including mesh shading and a text overlay.

### *Network Simulator*
- Fixed an `ObjectDisposedException` happening after disconnecting and reconnecting while using the Network Simulator.
- Fixed duplicated `NetworkSimulatorPresets`.

### *Runtime Net Stats Monitor*
- Fixed an issue that prevented using the ``RuntimeNetStatsMonitor.AddCustomValue`` API for stats that are only sampled per second.
- Switched to a new color-blind friendly color-palette for default variable colors in graphs, which will provide increased contrast and more default values. This new color palette is the same one used in the new Network Scene Visualization tool.
- Reduced the maximum sample count in Graphs and Simple Moving Average counters from 4096 to 512. Sample counts higher than 512 are no longer needed since per-second sampling was introduced in 1.1.0.
- Deprecated public methods that could be used to control the conditional compilation of the RNSM. Conditional compilation of the RNSM will be removed in a future major release.

## [1.1.0] - 2022-09-22

### *Metrics*
- Improve the warning message for throttling, and increase the threshold for throttling a metric from 100 to 1,000 recorded events per frame.

### *Misc*
- Fixed compilation warning related to unsupported build targets

### *Runtime Net Stats Monitor*
- Graphs and Simple Moving Average counters can now be configured to be sampled per-second rather than per-frame
- Fixed an issue where RNSM line graphs could retain incorrect maximum values in some cases

## [1.0.0] - 2022-06-27

### *Runtime Net Stats Monitor*
- Doc-comment fixes based on 1.0 release XML doc validation

## [1.0.0-pre.8] - 2022-06-15

### *Runtime Net Stats Monitor*
- Clamping numerical values to acceptable limits for public APIs
- Improve generated counter labels
- Prevent an exception when there's only one sample
- Added spacing between divider graph and axis number alignment
- Reusing existing numerical labels when the value doesn't change or barely changed
- Fix incorrect values for gauges in counter display elements using SMA
- Ensure RNSM counters display 1 rather than 1,000 milli
- Use infinity rather than float.Min for counter config bounds
- Reduce vertices in graphs with large sample count

## [1.0.0-pre.7] - 2022-04-27

### *Runtime Net Stats Monitor*

This release adds the Runtime Net Stats Monitor (RNSM) to the Multiplayer Tools Package. This tool offers a configurable component for displaying various network stats in an on-screen display at runtime, including stats from the Netcode for GameObjects package, as well as custom, user-defined stats.

For more information about the Runtime Net Stats Monitor, please see its documentation.

## [1.0.0-pre.6] - 2022-02-28

### *Network Profiler*
- Changed NetworkMessage to use the name of the message in the Type column

### *Metrics*
- Added throttling to event metric types
- Added a system to generate random data for tests
- Refactored underlying data structures to reduce redundancy
- Dramatically reduced runtime allocations caused by dispatching metrics to the profiler by updating the serialization implementation to use native buffers instead of BinaryFormatter
- Deprecated support for String when collecting metric payloads
- Added RTT to server metrics
- Added Packet count to metrics

### *Misc*
- Updated some internals exposed flags to enable some test improvements on NGO side

## [1.0.0-pre.2] - 2021-10-19

- Updated documentation files in preparation for publish

## [1.0.0-pre.1] - 2021-08-18

### *Netcode Profiler*

This release adds the Netcode Profiler to the Multiplayer Tools Package. This tool is used to inspect the network activity of **Netcode for GameObjects**.

#### Activity Section
- View detailed metrics about custom messages, scene transitions, and server logs
- View activity related to individual game objects, including network variable updates, rpcs, spawn and destroy events, and ownership changes

#### Messages Section
- View the raw messages that are being sent to the transport interface

#### Other Usability
- Connect to built players to inspect netcode activity remotely
- Filter results by name, type, number of bytes, and network direction
- Correlate network objects in the profiler with objects in the scene hierarchy
- View key metrics in graph form in the profiler charts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.2.0] - 2024-07-24

### *General*
- Changed Window Menu location to Window/Multiplayer
- Activated the Hierarchy Network Debug View (Hierarchy overlay indicating NetworkObjects and ownership)

### *Network Scene Visualization*
- Fixed an issue where the console was spammed with errors when disconnecting from NGO.

### *Network Simulator*
- Fixed NullRef in Sample Scenario ConnectionParametersWithCurves

### *Runtime Net Stats Monitor*
- Fixed an issue throwing UI Layout errors when changing RNSM position

## [2.1.0] - 2023-11-21

### *General*
Expand Down
2 changes: 0 additions & 2 deletions CODEOWNERS

This file was deleted.

11 changes: 11 additions & 0 deletions Common/Runtime/Extensions/ProfilerUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@

namespace Unity.Multiplayer.Tools.Common
{
/// <summary>
/// A Helper class for Profiler scoping
/// </summary>
public ref struct ProfilerScope
{
/// <summary>
/// Static method returning a new ProfilerScope object and starting the sampling
/// </summary>
/// <param name="name">The name of the Profiler Sample</param>
/// <returns>The ProfilerScope object</returns>
public static ProfilerScope BeginSample(string name)
{
return new ProfilerScope(name);
Expand All @@ -14,6 +22,9 @@ public static ProfilerScope BeginSample(string name)
Profiler.BeginSample(name);
}

/// <summary>
/// Stopping the Profiler sampling on Disposal of the object (end of scope)
/// </summary>
public void Dispose()
{
Profiler.EndSample();
Expand Down
Loading

0 comments on commit 49bf93d

Please sign in to comment.