branchrust_reboot/main/hackweek_pool_refillcancel
5 Commits over 0 Days - ∞cph!
Add RefillAsync() method but it already doesn't work on 2022
- the Transform parent parameter is ignored and not fixed until Unity 6 so the refilled prefabs are spawned in the main scene instead of attached to the inactive root
Add editor only behavior to create pools when a prefab is first instantiated
- currently it will only create the pool & start refilling it once the prefab is killed, not when it is first spawned
- convar `instantiate_creates_pools` (default false) will cause the pool to created after the prefab is first spawned
- this isn't an issue in standalone builds as it will warmup the prefabs on the menu and fill the prefab pool while connecting to the server
- can't use the warmup command to fill pools in the editor as that takes 30s+ and isn't great for testing
Store time taken to instantiate each prefab when refilling the pool
- base the average on up to the last 20 prefabs spawned
- used to determine if we need to move onto async instantiation (for hackweek we will play around but later on)
- use estimated time to enforce the per-frame budget a big more aggressively (don't instantiate a new prefab if it will exceed budget by 20%)
Start by adding simple pool refilling
- 0.1ms per frame creating prefabs until each pool is full
- keep list of partially full pools, loop through them in order
Fix print_prefabs having wrong order of columns (existing issue??)