Class NetworkVariableBaseInitializesWhenPersisted.PrefabInstanceHandler
Creates a specified number of instances that persist throughout the entire test session
and will only be destroyed/released during the OneTimeTeardown
Inheritance
NetworkVariableBaseInitializesWhenPersisted.PrefabInstanceHandler
Assembly: Unity.Netcode.RuntimeTests.dll
Syntax
public class NetworkVariableBaseInitializesWhenPersisted.PrefabInstanceHandler : INetworkPrefabInstanceHandler
Constructors
PrefabInstanceHandler(GameObject)
Declaration
public PrefabInstanceHandler(GameObject gameObject)
Parameters
Fields
PrefabInstances
Declaration
public Queue<GameObject> PrefabInstances
Field Value
Methods
AssignHandler(NetworkManager)
Declaration
public static void AssignHandler(NetworkManager networkManager)
Parameters
Type |
Name |
Description |
NetworkManager |
networkManager |
The NetworkManager instance to assign a handler to. Must not be null and must not already have a handler assigned.
|
CleanInstances()
When we are done with all tests, we finally destroy the persisted objects
Declaration
public void CleanInstances()
DeregisterHandler()
Declaration
public void DeregisterHandler()
Destroy(NetworkObject)
Declaration
public void Destroy(NetworkObject networkObject)
Parameters
GetInstance()
Declaration
public NetworkObject GetInstance()
Returns
GetInstanceToSpawn(NetworkManager)
Declaration
public static NetworkObject GetInstanceToSpawn(NetworkManager networkManager)
Parameters
Returns
Initialize(NetworkManager)
Declaration
public void Initialize(NetworkManager networkManager)
Parameters
Instantiate(ulong, Vector3, Quaternion)
Declaration
public NetworkObject Instantiate(ulong ownerClientId, Vector3 position, Quaternion rotation)
Parameters
Returns
OneTimeSetup(int, GameObject)
Declaration
public static void OneTimeSetup(int numberOfInstances, GameObject prefabInstance)
Parameters
Type |
Name |
Description |
int |
numberOfInstances |
|
GameObject |
prefabInstance |
|
ReleaseAll(bool)
Releases back to the queue and if destroy is true it will completely
remove all references so they are cleaned up when
Declaration
public static void ReleaseAll(bool destroy = false)
Parameters
Type |
Name |
Description |
bool |
destroy |
If true, completely removes all references and cleans up instances. If false, returns handlers to the queue for reuse.
|
ValidateInstanceSpawnCount(int)
This validates that the instances persisted to the next test set and persisted
between network sessions
Declaration
public bool ValidateInstanceSpawnCount(int minCount)
Parameters
Type |
Name |
Description |
int |
minCount |
|
Returns
ValidatePersistedInstances(NetworkManager, int)
Declaration
public static bool ValidatePersistedInstances(NetworkManager networkManager, int minCount)
Parameters
Returns
Implements