Skip to content

Updated to match tools PR that decouples network profiler references #961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
11 changes: 3 additions & 8 deletions com.unity.multiplayer.mlapi/Runtime/Metrics/NetworkMetrics.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#if MULTIPLAYER_TOOLS

using System.Collections.Generic;
using Unity.Multiplayer.MetricTypes;
using Unity.Multiplayer.NetStats.Dispatch;
using Unity.Multiplayer.NetStats.Metrics;
using Unity.Multiplayer.NetworkProfiler;
using Unity.Multiplayer.NetworkProfiler.Models;
using Unity.Multiplayer.NetStatsReporting;

namespace MLAPI.Metrics
{
Expand Down Expand Up @@ -142,12 +142,7 @@ private static string PrettyPrintVariableName(string variableName)

public class MLAPIObserver
{
public static IMetricObserver Observer { get; }

static MLAPIObserver()
{
Observer = new NetStatObserver();
}
public static IMetricObserver Observer { get; } = MetricObserverFactory.Construct();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "Unity.Multiplayer.MLAPI.Runtime",
"rootNamespace": "MLAPI",
"references": [
"GUID:3450dc9e228065a499e6e09dee931704",
"GUID:b1cd7326e664a434ab35daa802773c7f"
"GUID:821943bbff0df3b48b43584136c29e17",
"GUID:b1cd7326e664a434ab35daa802773c7f",
"GUID:7c4416f9e8f132246b0e1c1ec45be7d6"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
using MLAPI.Metrics;
using MLAPI.Serialization;
using NUnit.Framework;
using Unity.Multiplayer.NetworkProfiler;
using Unity.Multiplayer.NetworkProfiler.Models;
using Unity.Multiplayer.MetricTypes;
using UnityEngine.TestTools;

namespace MLAPI.RuntimeTests.Metrics.Messaging
Expand Down Expand Up @@ -53,7 +52,7 @@ public IEnumerator TrackNamedMessageSentMetric()
public IEnumerator TrackNamedMessageSentMetricToMultipleClients()
{
var messageName = Guid.NewGuid().ToString();

var waitForMetricValues = new WaitForMetricValues<NamedMessageEvent>(m_NetworkMetrics.Dispatcher, MetricNames.NamedMessageSent);
m_NetworkManager.CustomMessagingManager.SendNamedMessage(messageName, new List<ulong> { 100, 200, 300 }, Stream.Null);

Expand All @@ -73,7 +72,7 @@ public IEnumerator TrackNamedMessageSentMetricToMultipleClients()
public IEnumerator TrackUnnamedMessageSentMetric()
{
var clientId = 100UL;

var waitForMetricValues = new WaitForMetricValues<UnnamedMessageEvent>(m_NetworkMetrics.Dispatcher, MetricNames.UnnamedMessageSent);
m_NetworkManager.CustomMessagingManager.SendUnnamedMessage(clientId, new NetworkBuffer());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
using MLAPI.Metrics;
using MLAPI.Serialization;
using NUnit.Framework;
using Unity.Multiplayer.NetworkProfiler;
using Unity.Multiplayer.NetworkProfiler.Models;
using Unity.Multiplayer.MetricTypes;
using UnityEngine;
using UnityEngine.TestTools;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
using System.Linq;
using MLAPI.Metrics;
using NUnit.Framework;
using Unity.Multiplayer.NetworkProfiler;
using Unity.Multiplayer.NetworkProfiler.Models;
using Unity.Multiplayer.MetricTypes;
using UnityEngine;
using UnityEngine.TestTools;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
using System.Linq;
using MLAPI.Metrics;
using NUnit.Framework;
using Unity.Multiplayer.NetworkProfiler;
using Unity.Multiplayer.NetworkProfiler.Models;
using Unity.Multiplayer.MetricTypes;
using UnityEngine.TestTools;

namespace MLAPI.RuntimeTests.Metrics.NetworkVariables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
using System.Linq;
using MLAPI.Metrics;
using NUnit.Framework;
using Unity.Multiplayer.NetworkProfiler;
using Unity.Multiplayer.NetworkProfiler.Models;
using Unity.Multiplayer.MetricTypes;
using UnityEngine;
using UnityEngine.TestTools;

Expand All @@ -23,7 +22,7 @@ public IEnumerator SetUp()
Debug.LogError("Failed to create instances");
Assert.Fail("Failed to create instances");
}

var playerPrefab = new GameObject("Player");
var networkObject = playerPrefab.AddComponent<NetworkObject>();
playerPrefab.AddComponent<NetworkVariableComponent>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@
"rootNamespace": "",
"references": [
"Unity.Multiplayer.MLAPI.Runtime",
"Unity.Multiplayer.NetworkProfiler.Runtime",
"Unity.Multiplayer.MetricTypes",
"Unity.Multiplayer.NetStats",
"Unity.Multiplayer.MLAPI.Editor"
],
"optionalUnityReferences": [
"TestAssemblies"
"Unity.Multiplayer.MLAPI.Editor",
"UnityEngine.TestRunner",
"UnityEditor.TestRunner"
],
"includePlatforms": [],
"excludePlatforms": []
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}