-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## [2.0.0-pre.2] - 2023-05-02 ### *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. ### *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.
- Loading branch information
Unity Technologies
committed
May 2, 2023
1 parent
ba56662
commit 9383add
Showing
668 changed files
with
8,506 additions
and
8,373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,4 @@ class NetworkParameters | |
|
||
public int PacketLossPercent { get; set; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ interface ISimulateDisconnect : IAdapterComponent | |
{ | ||
void SimulateDisconnect(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ interface ISimulateReconnect : IAdapterComponent | |
{ | ||
void SimulateReconnect(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Unity.Multiplayer.Tools.Adapters | ||
{ | ||
interface IGetConnectedClients : IAdapterComponent | ||
{ | ||
IReadOnlyList<ClientId> ConnectedClients { get; } | ||
event Action<ClientId> ClientConnectionEvent; | ||
event Action<ClientId> ClientDisconnectionEvent; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
using System; | ||
|
||
using Unity.Multiplayer.Tools.NetStats; | ||
|
||
namespace Unity.Multiplayer.Tools.Adapters | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,40 @@ | ||
using System; | ||
using Unity.Multiplayer.Tools.Common; | ||
|
||
namespace Unity.Multiplayer.Tools.Adapters | ||
{ | ||
/// <summary> | ||
/// Interface to get object bandwidth in bytes this frame | ||
/// Interface to get the bandwidth in bytes of an object this frame | ||
/// </summary> | ||
interface IGetBandwidth : IAdapterComponent | ||
{ | ||
int GetBandwidthBytes(ObjectId objectId); | ||
/// <summary> | ||
/// Returns the types of bandwidth that are supported by this adapter | ||
/// </summary> | ||
BandwidthTypes SupportedBandwidthTypes { get; } | ||
|
||
/// <summary> | ||
/// Returns the amount of bandwidth related to this object, filtered by bandwidth type and direction. | ||
/// </summary> | ||
/// <remarks> | ||
/// If any of the bandwidth type flags are not supported by this adapter then they will be ignored | ||
/// and will not contribute to the total bandwidth returned. If none of the bandwidth flags are | ||
/// supported by this adapter then the bandwidth returned will be zero. | ||
/// </remarks> | ||
/// <exception cref="NoSubscribersException"> | ||
/// may be thrown if this method is called without any subscribers to <see cref="OnBandwidthUpdated"/>. | ||
/// This is to ensure that object bandwidth is computed and stored only if required. | ||
/// </exception> | ||
float GetBandwidthBytes( | ||
ObjectId objectId, | ||
BandwidthTypes bandwidthTypes = BandwidthTypes.All, | ||
NetworkDirection networkDirection = NetworkDirection.SentAndReceived); | ||
|
||
/// <summary> | ||
/// Event that is triggered when new object bandwidth data is available. | ||
/// If there are no subscribers, then bandwidth may not be computed and stored | ||
/// by the underlying implementation. | ||
/// </summary> | ||
event Action OnBandwidthUpdated; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ interface IGetGameObject : IAdapterComponent | |
{ | ||
GameObject GetGameObject(ObjectId objectId); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ interface IGetInterest : IAdapterComponent | |
{ | ||
bool GetInterest(ObjectId objectId); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ interface IGetOwnership : IAdapterComponent | |
{ | ||
ClientId GetOwner(ObjectId objectId); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ interface IGetPriority : IAdapterComponent | |
{ | ||
int GetPriority(ObjectId objectId); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
using System; | ||
|
||
namespace Unity.Multiplayer.Tools.Adapters | ||
{ | ||
/// <summary> | ||
/// Interface to get the number of RPCs called on an object this frame | ||
/// </summary> | ||
interface IGetRpcCount : IAdapterComponent | ||
{ | ||
/// <exception cref="NoSubscribersException"> | ||
/// may be thrown if this method is called without any subscribers to <see cref="OnRpcCountUpdated"/>. | ||
/// This is to ensure that object bandwidth is computed and stored only if required. | ||
/// </exception> | ||
int GetRpcCount(ObjectId objectId); | ||
|
||
/// <summary> | ||
/// Event that is triggered when new object RPC counts are available. | ||
/// If there are no subscribers, then RPC counts may not be computed and stored | ||
/// by the underlying implementation. | ||
/// </summary> | ||
event Action OnRpcCountUpdated; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ interface IGetLastKnownObjectTransform : IAdapterComponent | |
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ interface IGetObjectTransformPredicted : IAdapterComponent | |
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ interface IGetTransformWithoutArtificialLatency : IAdapterComponent | |
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ interface INetworkAvailability : IAdapterComponent | |
{ | ||
bool IsConnected { get; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ enum ObjectId : long | |
{ | ||
// No members on purpose, this is a wrapper struct for strong typing | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
|
||
namespace Unity.Multiplayer.Tools.Adapters | ||
{ | ||
/// <summary> | ||
/// Exception for accessing information from the adapter | ||
/// when there are no subscribers for this piece of information. | ||
/// </summary> | ||
class NoSubscribersException : Exception | ||
{ | ||
public NoSubscribersException(string resourceName, string subscriptionMethodName) | ||
: base( | ||
$"Attempt to use {resourceName} without any subscribers. " + | ||
$"Subscribe using {subscriptionMethodName}, so that the " + | ||
$"adapter knows to compute and store this information.") | ||
{} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ata/ExponentialMovingAverageTests.cs.meta → ...Exceptions/NoSubscribersException.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ interface IAdapterComponent | |
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ interface INetworkAdapter | |
[CanBeNull] | ||
T GetComponent<T>() where T : class, IAdapterComponent; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ struct AdapterMetadata | |
{ | ||
public PackageInfo PackageInfo { get; set; } | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ struct PackageInfo | |
public string PackageName { get; set; } | ||
public PackageVersion Version { get; set; } | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ struct PackageVersion | |
public int Patch { get; set; } | ||
public string PreRelease { get; set; } | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace Unity.Multiplayer.Tools.Adapters.MockNgo | ||
{ | ||
class Constants | ||
{ | ||
public const int k_DefaultSpawnMessageByteCount = 36; | ||
|
||
public const int k_DefaultDespawnMessageByteCount = 8; | ||
|
||
public const int k_DefaultOwnershipChangeByteCount = 16; | ||
|
||
public const int k_DefaultPositionChangeByteCount = 12; | ||
|
||
public const int k_DefaultRotationChangeByteCount = 12; | ||
|
||
public const int k_DefaultScaleChangeByteCount = 12; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace Unity.Multiplayer.Tools.Adapters.MockNgo | ||
{ | ||
/// <summary> | ||
/// A mock network manager containing the mock client ID of the local instance | ||
/// and parameters of the underlying mock network solution (like how many bytes | ||
/// must be sent or received to update an object's position) | ||
/// </summary> | ||
/// <remarks> | ||
/// There should be only one of these. | ||
/// </remarks> | ||
[AddComponentMenu("MP Tools Dev/" + nameof(MockNetworkManager), 1000)] | ||
public class MockNetworkManager : MonoBehaviour | ||
{ | ||
internal MockNgoAdapter Adapter { get; private set; } | ||
|
||
void Awake() | ||
{ | ||
Adapter = new(() => (ClientId)LocalClientID); | ||
} | ||
|
||
void LateUpdate() | ||
{ | ||
Adapter.OnLateUpdate(); | ||
} | ||
|
||
void OnDestroy() | ||
{ | ||
Adapter.Dispose(); | ||
} | ||
|
||
/// <summary> | ||
/// The client ID of the local instance | ||
/// </summary> | ||
public int LocalClientID { get; set; } = 0; | ||
|
||
/// <summary> | ||
/// The number of bytes of network traffic incurred when an object is spawned. | ||
/// </summary> | ||
[field:Min(0)] | ||
[field:SerializeField] | ||
public int SpawnMessageByteCount { get; set; } = Constants.k_DefaultSpawnMessageByteCount; | ||
|
||
/// <summary> | ||
/// The number of bytes of network traffic incurred when an object is despawned. | ||
/// </summary> | ||
[field:Min(0)] | ||
[field:SerializeField] | ||
public int DespawnMessageByteCount { get; set; } = Constants.k_DefaultDespawnMessageByteCount; | ||
|
||
/// <summary> | ||
/// The number of bytes of network traffic incurred when an object's owner is changed | ||
/// </summary> | ||
[field:Min(0)] | ||
[field:SerializeField] | ||
public int OwnershipChangeByteCount { get; set; } = Constants.k_DefaultOwnershipChangeByteCount; | ||
|
||
/// <summary> | ||
/// The number of bytes of network traffic incurred when an object's position changes. | ||
/// </summary> | ||
[field:Min(0)] | ||
[field:SerializeField] | ||
public int PositionUpdateByteCount { get; set; } = Constants.k_DefaultPositionChangeByteCount; | ||
|
||
/// <summary> | ||
/// The number of bytes of network traffic incurred when an object's rotation changes. | ||
/// </summary> | ||
[field:Min(0)] | ||
[field:SerializeField] | ||
public int RotationUpdateByteCount { get; set; } = Constants.k_DefaultRotationChangeByteCount; | ||
|
||
/// The number of bytes of network traffic incurred when an object's scale changes. | ||
[field:Min(0)] | ||
[field:SerializeField] | ||
public int ScaleUpdateByteCount { get; set; } = Constants.k_DefaultScaleChangeByteCount; | ||
} | ||
} |
Oops, something went wrong.