Tests: CreateNetworked without NetworkBehaviour

This commit is contained in:
vis2k 2021-05-19 12:37:20 +08:00
parent c4491fe0d6
commit dc70cd33d7

View File

@ -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<GameObject> tracker = null)
where T : NetworkBehaviour
{
go = new GameObject();
identity = go.AddComponent<NetworkIdentity>();
tracker?.Add(go);
}
// create GameObject + NetworkIdentity + NetworkBehaviour<T>
// add to tracker list if needed (useful for cleanups afterwards)
public static void CreateNetworked<T>(out GameObject go, out NetworkIdentity identity, out T component, List<GameObject> tracker = null)