Skip to main content

EntitySpawnTest

A class in Root.Township, the global namespace.

Debug stress test that spawns or destroys a number of copies of a network prefab every frame through its entity's spawner.

Constructors​

MemberWhat it is
EntitySpawnTest()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

9 private and internal fields
MemberWhat it is
private List<NetworkEntity> currentlySpawnedEntities spawned and not yet destroyed.
private NetworkEntity entityThis object's entity, whose spawner is used.
private int existingCountHow many spawned entities still exist.
private bool isDeletingAllInspector button that destroys all spawned entities.
private bool isDeletingOldWhen on, destroys the oldest spawned entities each frame.
private bool isSpawningWhen on, spawns new entities each frame.
private int numberToSpawnEachFrameHow many to spawn or destroy per frame.
private NetworkPrefab prefabToSpawnThe network prefab to spawn.
private int spawnedCountTotal spawned so far.

Methods​

3 private and internal methods
MemberWhat it is
private void Awake()Finds the NetworkEntity on the same object.
private void OnValidate()When the Delete All button is pressed, destroys every spawned entity.
private void Update()Destroys the oldest spawned entities and/or spawns new ones, numberToSpawnEachFrame at a time, and updates the counters.