A class in Root.Township, the global namespace.
Editor test tool that times spawning, instantiating, initializing and destroying network prefabs, for one prefab or all of them into a CSV.
Constructors
| Member | What it is |
|---|
SpawningTimer() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
| Member | What it is |
|---|
private bool isSpawning | Inspector button that runs Spawn. |
private bool isTestingAll | Inspector button that runs the slow all-prefabs test. |
private int numberOfTimesToSpawn | How many copies each test makes. |
private NetworkPrefab prefabToSpawn | Prefab timed by Spawn. |
private NetworkScene scene | Network scene whose spawner is used. |
private Stopwatch stopwatch | Stopwatch reused by TimeFunction. |
Methods
6 private and internal methods
| Member | What it is |
|---|
private void Awake() | Finds the NetworkScene if none is set. |
private void Spawn() | Times the chosen prefab and logs each average as an error so it shows up. |
private IEnumerator SpawnAll() (iterator) | Coroutine that times every prefab under Resources/Network Prefabs/ and writes spawn-times.csv in the data folder. |
private void StartSpawningAll() | Starts SpawnAll. |
private double TimeFunction(Action functionToTime) | Runs an action and returns the milliseconds it took, or -1 if it threw. |
private SpawningTimer.ResultTimes TimeSpawnPrefab(NetworkPrefab prefabToSpawn) | Spawns, instantiates, initializes, rescales and destroys a prefab many times and returns the total times. |