diff --git a/testproject/Assets/Scenes/MultiprocessTestScene.unity b/testproject/Assets/Scenes/MultiprocessTestScene.unity index efcf1f6661..57e243ca06 100644 --- a/testproject/Assets/Scenes/MultiprocessTestScene.unity +++ b/testproject/Assets/Scenes/MultiprocessTestScene.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657838, g: 0.49641234, b: 0.57481676, a: 1} + m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -212,7 +212,6 @@ Transform: m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} m_LocalPosition: {x: 0, y: 3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 1 @@ -223,8 +222,8 @@ LightingSettings: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: - serializedVersion: 4 + m_Name: + serializedVersion: 3 m_GIWorkflowMode: 1 m_EnableBakedLightmaps: 1 m_EnableRealtimeLightmaps: 0 @@ -237,7 +236,7 @@ LightingSettings: m_LightmapMaxSize: 1024 m_BakeResolution: 40 m_Padding: 2 - m_LightmapCompression: 3 + m_TextureCompression: 1 m_AO: 0 m_AOMaxDistance: 1 m_CompAOExponent: 1 @@ -278,7 +277,6 @@ LightingSettings: m_PVRFilteringAtrousPositionSigmaDirect: 0.5 m_PVRFilteringAtrousPositionSigmaIndirect: 2 m_PVRFilteringAtrousPositionSigmaAO: 1 - m_PVRTiledBaking: 0 --- !u!1 &160940364 GameObject: m_ObjectHideFlags: 0 @@ -371,7 +369,6 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: -10, y: -10, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 5 @@ -405,10 +402,10 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 04cf3cc1396054b009a1ed283aa50021, type: 3} - m_Name: - m_EditorClassIdentifier: + m_Name: + m_EditorClassIdentifier: IsTestCoordinatorActiveAndEnabled: 0 - CommandLineArguments: + CommandLineArguments: --- !u!102 &430011405 TextMesh: serializedVersion: 3 @@ -481,9 +478,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 430011403} m_LocalRotation: {x: 0.2164396, y: 0, z: 0, w: 0.97629607} - m_LocalPosition: {x: -40, y: 0, z: 10} + m_LocalPosition: {x: -45, y: 10, z: 10} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 7 @@ -567,7 +563,6 @@ Transform: m_LocalRotation: {x: 0.21736304, y: -0, z: -0, w: 0.97609085} m_LocalPosition: {x: 0, y: 9.15, z: -27.5} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 @@ -664,7 +659,6 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 4 @@ -761,7 +755,6 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 10, y: 10, z: 10} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 3 @@ -795,8 +788,8 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 593a2fe42fa9d37498c96f9a383b6521, type: 3} - m_Name: - m_EditorClassIdentifier: + m_Name: + m_EditorClassIdentifier: RunInBackground: 1 LogLevel: 1 NetworkConfig: @@ -814,7 +807,7 @@ MonoBehaviour: TickRate: 30 ClientConnectionBufferTimeout: 10 ConnectionApproval: 0 - ConnectionData: + ConnectionData: EnableTimeResync: 0 TimeResyncInterval: 30 EnsureNetworkVariableLengthSafety: 0 @@ -836,7 +829,6 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1674777072} - {fileID: 2027640072} @@ -853,8 +845,8 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 068bf11ceb1344667af4cc40950f44f4, type: 3} - m_Name: - m_EditorClassIdentifier: + m_Name: + m_EditorClassIdentifier: ReferencedPrefab: {fileID: 9115731988109684252, guid: c2851feb7276442cc86a6f2d1d69ea11, type: 3} --- !u!114 &1211923378 @@ -867,8 +859,8 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 55d1c75ce242745ac98f7e7aca6d2d19, type: 3} - m_Name: - m_EditorClassIdentifier: + m_Name: + m_EditorClassIdentifier: --- !u!1 &1274245423 GameObject: m_ObjectHideFlags: 0 @@ -897,8 +889,8 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3} - m_Name: - m_EditorClassIdentifier: + m_Name: + m_EditorClassIdentifier: GlobalObjectIdHash: 2217825759 AlwaysReplicateAsRoot: 0 DontDestroyWithOwner: 0 @@ -913,7 +905,6 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 10, y: 10, z: 10} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 6 @@ -928,8 +919,8 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: ef1240e0784f84eadb77fe822e2e03c7, type: 3} - m_Name: - m_EditorClassIdentifier: + m_Name: + m_EditorClassIdentifier: --- !u!1 &1674777071 GameObject: m_ObjectHideFlags: 0 @@ -957,7 +948,6 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1211923376} m_RootOrder: 0 @@ -972,8 +962,8 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: b84c2d8dfe509a34fb59e2b81f8e1319, type: 3} - m_Name: - m_EditorClassIdentifier: + m_Name: + m_EditorClassIdentifier: MessageBufferSize: 50000 MaxConnections: 100 MaxSentMessageQueueSize: 50000 @@ -1008,7 +998,6 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1211923376} m_RootOrder: 1 @@ -1023,8 +1012,8 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 6960e84d07fb87f47956e7a81d71c4e6, type: 3} - m_Name: - m_EditorClassIdentifier: + m_Name: + m_EditorClassIdentifier: m_ProtocolType: 0 m_MaxPacketQueueSize: 128 m_MaxPayloadSize: 4096 @@ -1036,7 +1025,7 @@ MonoBehaviour: ConnectionData: Address: 127.0.0.1 Port: 7777 - ServerListenAddress: + ServerListenAddress: DebugSimulator: PacketDelayMS: 0 PacketJitterMS: 0 diff --git a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/BaseMultiprocessTests.cs b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/BaseMultiprocessTests.cs index 41da24ab43..9d33b33349 100644 --- a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/BaseMultiprocessTests.cs +++ b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/BaseMultiprocessTests.cs @@ -5,6 +5,9 @@ using UnityEngine.SceneManagement; using UnityEngine.TestTools; using Object = UnityEngine.Object; +using Unity.Netcode.Transports.UNET; +using Unity.Netcode.Transports.UTP; + namespace Unity.Netcode.MultiprocessRuntimeTests { @@ -77,6 +80,27 @@ private void OnSceneLoaded(Scene scene, LoadSceneMode mode) SceneManager.SetActiveScene(scene); } + var transport = NetworkManager.Singleton.NetworkConfig.NetworkTransport; + MultiprocessLogger.Log($"transport is {transport}"); + switch (transport) + { + case UNetTransport unetTransport: + unetTransport.ConnectPort = int.Parse(TestCoordinator.Port); + unetTransport.ServerListenPort = int.Parse(TestCoordinator.Port); + unetTransport.ConnectAddress = "127.0.0.1"; + MultiprocessLogger.Log($"Setting ConnectAddress to {unetTransport.ConnectAddress} port {unetTransport.ConnectPort}, {unetTransport.ServerListenPort}"); + + break; + case UnityTransport unityTransport: + unityTransport.ConnectionData.ServerListenAddress = "0.0.0.0"; + MultiprocessLogger.Log($"Setting unityTransport.ConnectionData.Port {unityTransport.ConnectionData.ServerListenAddress}"); + break; + default: + MultiprocessLogger.LogError($"The transport {transport} has no case"); + break; + } + + MultiprocessLogger.Log("Starting Host"); NetworkManager.Singleton.StartHost(); // Use scene verification to make sure we don't try to get clients to synchronize the TestRunner scene diff --git a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationTools.cs b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationTools.cs new file mode 100644 index 0000000000..28c8c42db7 --- /dev/null +++ b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationTools.cs @@ -0,0 +1,69 @@ +using UnityEngine; +using System; +using System.Net.Http; +using System.Threading; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace Unity.Netcode.MultiprocessRuntimeTests +{ + public class ConfigurationTools + { + public static async Task GetRemoteConfig() + { + var theList = new JobQueueItemArray(); + using var client = new HttpClient(); + var cancelAfterDelay = new CancellationTokenSource(TimeSpan.FromSeconds(10)); + var response = await client.GetAsync("https://multiprocess-log-event-manager.cds.internal.unity3d.com/api/JobWithFile", + HttpCompletionOption.ResponseHeadersRead, cancelAfterDelay.Token).ConfigureAwait(false); + var content = await response.Content.ReadAsStringAsync(); + JsonUtility.FromJsonOverwrite(content, theList); + return theList; + } + + public static async void CompleteJobQueueItem(JobQueueItem item) + { + await PostJobQueueItem(item, "/complete"); + } + + public static async void ClaimJobQueueItem(JobQueueItem item) + { + await PostJobQueueItem(item, "/claim"); + } + + public static async Task PostJobQueueItem(JobQueueItem item, string path = "") + { + using var client = new HttpClient(); + using var request = new HttpRequestMessage(HttpMethod.Post, "https://multiprocess-log-event-manager.cds.internal.unity3d.com/api/JobWithFile" + path); + var json = JsonUtility.ToJson(item); + using var stringContent = new StringContent(json, Encoding.UTF8, "application/json"); + request.Content = stringContent; + MultiprocessLogger.Log($"Posting remoteConfig to server {json}"); + var cancelAfterDelay = new CancellationTokenSource(TimeSpan.FromSeconds(20)); + var response = await client + .SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancelAfterDelay.Token).ConfigureAwait(false); + MultiprocessLogger.Log($"remoteConfig posted, checking response {response.StatusCode}"); + } + } + + [Serializable] + public class JobQueueItemArray + { + public List JobQueueItems; + } + + [Serializable] + public class JobQueueItem + { + public int Id; + public long JobId; + public string GitHash; + public string HostIp; + public int PlatformId; + public int JobStateId; + public string CreatedBy; + public string UpdatedBy; + public string TransportName; + } +} diff --git a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationTools.cs.meta b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationTools.cs.meta new file mode 100644 index 0000000000..daf965ddca --- /dev/null +++ b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationTools.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ad11397b80c04404cb24e82cc7872334 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationType.cs b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationType.cs new file mode 100644 index 0000000000..bb9d097f62 --- /dev/null +++ b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationType.cs @@ -0,0 +1,9 @@ + +public enum ConfigurationType +{ + Unknown, + Remote, + CommandLine, + ResourceFile, + Host +} diff --git a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationType.cs.meta b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationType.cs.meta new file mode 100644 index 0000000000..9e89a3cb23 --- /dev/null +++ b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5b189bac115ca4587ba64943bfcc67f6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/MultiprocessLogger.cs b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/MultiprocessLogger.cs index 5181dbca50..c0cdd71162 100644 --- a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/MultiprocessLogger.cs +++ b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/MultiprocessLogger.cs @@ -28,6 +28,18 @@ public static void LogWarning(string msg) public class MultiprocessLogHandler : ILogHandler { + public static long JobId; + static MultiprocessLogHandler() + { + if (JobId == 0) + { + string sJobId = Environment.GetEnvironmentVariable("YAMATO_JOB_ID"); + if (!long.TryParse(sJobId, out JobId)) + { + JobId = -2; + } + } + } public void LogException(Exception exception, UnityEngine.Object context) { Debug.unityLogger.LogException(exception, context); diff --git a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/MultiprocessOrchestration.cs b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/MultiprocessOrchestration.cs index 1fea9ba92b..525aeef70f 100644 --- a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/MultiprocessOrchestration.cs +++ b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/MultiprocessOrchestration.cs @@ -117,7 +117,7 @@ public static string StartWorkerNode() case RuntimePlatform.WindowsEditor: workerProcess.StartInfo.FileName = $"{buildPath}.exe"; //extraArgs += "-popupwindow -screen-width 100 -screen-height 100"; - extraArgs += "-batchmode -nographics"; + extraArgs += "-popupwindow"; break; case RuntimePlatform.LinuxPlayer: case RuntimePlatform.LinuxEditor: diff --git a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/TestCoordinator.cs b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/TestCoordinator.cs index eca119054d..0a4e9436b8 100644 --- a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/TestCoordinator.cs +++ b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/TestCoordinator.cs @@ -1,11 +1,14 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Reflection; using Unity.Netcode; using NUnit.Framework; using UnityEngine; using Unity.Netcode.MultiprocessRuntimeTests; +using Unity.Netcode.Transports.UNET; +using Unity.Netcode.Transports.UTP; /// /// TestCoordinator @@ -37,9 +40,60 @@ public class TestCoordinator : NetworkBehaviour public static List AllClientIdsWithResults => Instance.m_TestResultsLocal.Keys.ToList(); public static List AllClientIdsExceptMine => NetworkManager.Singleton.ConnectedClients.Keys.ToList().FindAll(client => client != NetworkManager.Singleton.LocalClientId); - private void Awake() + // Multimachine support + private static int s_ProcessId; + public static string Rawgithash; + + private ConfigurationType m_ConfigurationType; + public ConfigurationType ConfigurationType + { + get { return m_ConfigurationType; } + private set + { + if (m_ConfigurationType != value) + { + m_ConfigurationType = value; + } + } + } + private string m_ConnectAddress = "127.0.0.1"; + public static string Port = "3076"; + private bool m_IsClient; + + private void SetConfigurationTypeAndConnect(ConfigurationType type) { - MultiprocessLogger.Log("Awake"); + ConfigurationType = type; + SetAddressAndPort(); + bool startClientResult = NetworkManager.Singleton.StartClient(); + MultiprocessLogger.Log($"Starting client"); + } + + public void Awake() + { + enabled = false; + NetworkManager.OnClientConnectedCallback += OnClientConnectedCallback; + + s_ProcessId = Process.GetCurrentProcess().Id; + MultiprocessLogger.Log($"Awake {s_ProcessId}"); + ReadGitHashFile(); + + // There are two possible ways for configuration data to be set + // 1. From a webapi + // 2. From a text file resource + bool isClient = Environment.GetCommandLineArgs().Any(value => value == MultiprocessOrchestration.IsWorkerArg); + if (isClient) + { + m_IsClient = isClient; + SetConfigurationTypeAndConnect(ConfigurationType.CommandLine); + } + + if (ConfigurationType == ConfigurationType.Unknown) + { + MultiprocessLogger.Log($"Awake {s_ProcessId} - Calling ConfigureViewWebApi"); + ConfigureViaWebApi(); + MultiprocessLogger.Log($"Awake {s_ProcessId} - Calling ConfigureViewWebApi completed"); + } + if (Instance != null) { MultiprocessLogger.LogError("Multiple test coordinator, destroying this instance"); @@ -50,22 +104,86 @@ private void Awake() Instance = this; } - public void Start() + private async void ConfigureViaWebApi() { - MultiprocessLogger.Log("Start"); - bool isClient = Environment.GetCommandLineArgs().Any(value => value == MultiprocessOrchestration.IsWorkerArg); - if (isClient) + MultiprocessLogger.Log($"ConfigureViaWebApi - start"); + var jobQueue = await ConfigurationTools.GetRemoteConfig(); + foreach (var job in jobQueue.JobQueueItems) + { + if (Rawgithash.Equals(job.GitHash)) + { + ConfigurationTools.ClaimJobQueueItem(job); + m_ConnectAddress = job.HostIp; + m_IsClient = true; + MultiprocessLogHandler.JobId = job.JobId; + SetConfigurationTypeAndConnect(ConfigurationType.Remote); + break; + } + else + { + MultiprocessLogger.Log($"No match between {Rawgithash} and {job.GitHash}"); + } + } + MultiprocessLogger.Log($"ConfigureViaWebApi - end {ConfigurationType}"); + } + + private void ReadGitHashFile() + { + try { - MultiprocessLogger.Log("starting netcode client"); - NetworkManager.Singleton.StartClient(); - MultiprocessLogger.Log($"started netcode client {NetworkManager.Singleton.IsConnectedClient}"); + var githash_resource = Resources.Load("Text/githash"); + if (githash_resource != null) + { + Rawgithash = githash_resource.ToString(); + if (!string.IsNullOrEmpty(Rawgithash)) + { + Rawgithash = Rawgithash.Trim(); + MultiprocessLogger.Log($"Rawgithash is {Rawgithash}"); + } + } } + catch (Exception e) + { + MultiprocessLogger.Log($"Exception getting githash resource file: {e.Message}"); + } + } + + private void SetAddressAndPort() + { + MultiprocessLogger.Log($"SetAddressAndPort - {Port} {m_ConnectAddress} {m_IsClient} "); + var ushortport = ushort.Parse(Port); + var transport = NetworkManager.Singleton.NetworkConfig.NetworkTransport; + MultiprocessLogger.Log($"transport is {transport}"); + switch (transport) + { + case UNetTransport unetTransport: + unetTransport.ConnectPort = ushortport; + unetTransport.ServerListenPort = ushortport; + if (m_IsClient) + { + MultiprocessLogger.Log($"Setting ConnectAddress to {m_ConnectAddress} port {ushortport} isClient: {m_IsClient}"); + unetTransport.ConnectAddress = m_ConnectAddress; + } + break; + case UnityTransport unityTransport: + MultiprocessLogger.Log($"Setting unityTransport.ConnectionData.Port {ushortport}, isClient: {m_IsClient}, Address {m_ConnectAddress}"); + unityTransport.ConnectionData.Port = ushortport; + unityTransport.ConnectionData.Address = m_ConnectAddress; + break; + default: + MultiprocessLogger.LogError($"The transport {transport} has no case"); + break; + } + } + + public void Start() + { + MultiprocessLogger.Log("Start"); MultiprocessLogger.Log("Initialize All Steps"); ExecuteStepInContext.InitializeAllSteps(); MultiprocessLogger.Log($"Initialize All Steps... done"); MultiprocessLogger.Log($"IsInvoking: {NetworkManager.Singleton.IsInvoking()}"); MultiprocessLogger.Log($"IsActiveAndEnabled: {NetworkManager.Singleton.isActiveAndEnabled}"); - MultiprocessLogger.Log($"NetworkManager.NetworkConfig.NetworkTransport.name {NetworkManager.NetworkConfig.NetworkTransport.name}"); } public void Update() @@ -123,6 +241,13 @@ public void OnDisable() base.OnDestroy(); } + // Once we are connected, we can run the update method + public void OnClientConnectedCallback(ulong clientId) + { + MultiprocessLogger.Log("Client start callback, enabling behavior"); + enabled = true; + } + private static void OnClientDisconnectCallback(ulong clientId) { if (clientId == NetworkManager.ServerClientId || clientId == NetworkManager.Singleton.LocalClientId) diff --git a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/ThreeDText.cs b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/ThreeDText.cs index dda0e0ee94..6c7bc02d34 100644 --- a/testproject/Assets/Tests/Runtime/MultiprocessRuntime/ThreeDText.cs +++ b/testproject/Assets/Tests/Runtime/MultiprocessRuntime/ThreeDText.cs @@ -38,10 +38,15 @@ public void Start() string[] args = System.Environment.GetCommandLineArgs(); foreach (var arg in args) { - Debug.Log(arg); - CommandLineArguments += " " + arg; + if (arg.Length > 15) + { + CommandLineArguments += " " + arg.Substring(0, 14); + } + else + { + CommandLineArguments += "\n" + arg; + } } - Debug.Log($"CommandLineArguments {CommandLineArguments}"); } // Update is called once per frame @@ -69,14 +74,16 @@ public void Update() if (IsTestCoordinatorActiveAndEnabled != testCoordinator.isActiveAndEnabled || !m_HasFired || + m_UpdateCounter % 25 == 0 || !m_TransportString.Equals(transportString)) { m_HasFired = true; m_TransportString = transportString; IsTestCoordinatorActiveAndEnabled = testCoordinator.isActiveAndEnabled; - t.text = $"On Update -\ntestCoordinator.isActiveAndEnabled:{testCoordinator.isActiveAndEnabled}\n" + + t.text = $"On Update -\ntestCoordinator.isActiveAndEnabled:{testCoordinator.isActiveAndEnabled} {testCoordinator.ConfigurationType}\n" + $"Transport: {transportString}\n" + $"{CommandLineArguments}\n" + + $"IsHost: {NetworkManager.Singleton.IsHost} IsClient: {NetworkManager.Singleton.IsClient}\n" + $"{m_UpdateCounter}\n"; } }