diff --git a/Assets/Mirror/Tests/Common/TestUtils.cs b/Assets/Mirror/Tests/Common/TestUtils.cs index 0d326998f..ab0cecb13 100644 --- a/Assets/Mirror/Tests/Common/TestUtils.cs +++ b/Assets/Mirror/Tests/Common/TestUtils.cs @@ -7,6 +7,16 @@ namespace Mirror.Tests { public static class TestUtils { + // create GameObject + NetworkIdentity + // add to tracker list if needed (useful for cleanups afterwards) + public static void CreateNetworked(out GameObject go, out NetworkIdentity identity, List tracker = null) + where T : NetworkBehaviour + { + go = new GameObject(); + identity = go.AddComponent(); + tracker?.Add(go); + } + // create GameObject + NetworkIdentity + NetworkBehaviour // add to tracker list if needed (useful for cleanups afterwards) public static void CreateNetworked(out GameObject go, out NetworkIdentity identity, out T component, List tracker = null)