Skip to content

Archived on 2026-10-24. The Godot rewrite is cancelled. Migration decisions and work checklists below are withdrawn. Original claims, code examples, file paths, and completion statements have not all been revalidated. Use the current documentation and issue register for maintenance decisions.

Unity Prefab And Pool Usage Map

Purpose

Map major prefab categories used by pooling and spawn systems, identify which scripts spawn them, and record where pool growth or instantiate risk exists.

PoolManager Behavior

Area Current Unity Behavior
Script Assets/Script/Game/Managers/PoolManager.cs
Pool key Uses prefab name with (Clone) removed.
Get flow GetFromPool looks up a named queue. If the pool does not exist, it registers a new pool. If the queue is empty, it instantiates a new object.
Return flow DeactivateObject enqueues the object and disables it.
Risk No cap, no visible prewarm enforcement, and many high-frequency gameplay systems can create new pooled objects during combat spikes.

Major Prefab Categories

Category Examples / Fields Spawn Owners Pool Growth Risk
Creep enemies SpawnEvent.enemy in SpawnerData SpawnerEventManager.SpawnEnemy High during dense waves, especially if pools are cold or multiple events overlap.
Special enemies / minibosses specialSpawnerData.spawnEvents[].enemy SpawnerEventManager.SpecialSpawnSystem, MiniBossDeath clear path Medium; also state risk if special death does not clear active/miniboss flags.
Bosses LevelData.boss; boss spawn effects SpawnerEventManager.SpawnBoss Medium; boss transition pools spawn effect and boss object while doing other state work.
Enemy projectiles and attacks enemy attack fields, mortar/explosion prefabs, boss bullets Enemy, EnemyAttackRanged, EnemyAttackMortar, boss scripts, enemy state scripts High in bullet/summon-heavy fights.
Player basic attacks PlayerWeapon.attackPrefab, current weapon projectile refs PlayerWeapon.FireWeapon, some direct Instantiate paths High; most use pool, but at least one Instantiate(attackPrefab...) path remains.
Player hit/explosion effects attack hit effect, exploding enchantment explosion, barrier explosions PlayerAttack, Player, AbilityHolder Medium/High under high hit-rate builds.
Character ability effects Knight barrier/super slash, Archer arrows, Miner gems, StarWanderer missiles, Celestial swords/lightning, Priestess orb/veil AbilityHolder, PlayerAttack, companion scripts High for multishoot/rotator/homing cases.
General ability effects emergency barrier, stellar shield, reload shield, last stand, transcend/eclipse, airstrike, war cry, judgement sword AbilityHolder, PlayerAttackCarrier Medium; several are cooldown-driven but can stack across players.
Items and rewards XP/coin/gold/chest/potion drops, item merger objects Enemy, Items, ItemsBreakable, ItemsMerger High; drops can be numerous and Items.MergeChecking periodically spawns merger objects.
Damage popups damage number prefab Enemy.TakeDamage, GameManager.HardLimitPopUpDamage, DamagePopUp High in high attack speed builds; limiting occurs after popups are added.
Companions drone, sword, orb/chakram UpgradeFunction, AbilityHolder, Companion* scripts Medium/High; spawned on upgrades/evolutions and can spawn attacks repeatedly.
Map ornaments ornament prefabs MapGenerator Medium at map generation, not combat runtime. Uses direct Instantiate.
UI reward cards/buttons reward/collection/shop/leaderboard prefabs RewardRoller, menu/shop/collection UI scripts Low/Medium; mostly outside moment-to-moment combat.

Scripts With Notable Pool Calls

Script Prefab Types Spawned
SpawnerEventManager.cs enemies, boss spawn effect, boss prefab
Enemy.cs damage popups, enemy projectiles, item/reward drops
PlayerWeapon.cs player attacks, multishoot projectiles; also direct instantiate path for attack prefab
PlayerAttack.cs hit effects, explosions, ricochet/bounce bullets, hydra splits
AbilityHolder.cs character abilities, shields, explosions, missiles, swords, bombs, war cry, meditate, judgement
Player.cs damage response explosions, movement trails
PlayerAttackCarrier.cs explosions, airstrikes
CompanionDrone.cs, CompanionOrb.cs, CompanionSword.cs companion attacks
Items.cs, ItemsMerger.cs, ItemsBreakable.cs item merge objects, spawned collectibles, breakable drops
Enemy state/mechanic scripts bullets, indicators, ground attacks, summons, lava, bats, mortar carriers

Direct Instantiate Usage Worth Auditing

Script Use
Player.cs Instantiates starting weapon under player.
PlayerWeapon.cs Has a direct Instantiate(attackPrefab, ...) path in addition to pooled firing paths.
WeaponEvoData.cs Instantiates mechArm under player for weapon evolution.
RewardRoller.cs Instantiates reward buttons/cards.
MapGenerator.cs Instantiates map ornaments.
UI view scripts Instantiate shop, achievement, collection, leaderboard UI entries.
Tutorial scripts Use direct instantiation/searches; production scope Unknown / needs manual confirmation.

Pool Growth Risk Cases

Risk Evidence Suggested Unity-Side Check
Cold pool bursts PoolManager instantiates when a queue is empty. Log prefab name, active count, inactive count, and instantiate count per minute.
Projectile modifier multiplication Multishoot, Ricochet, HydraBarrage, Shrapnel, ExplodingEnchantment can create extra projectiles/effects per hit/fire. Profile high attack speed + multishoot + split builds.
Damage popup pressure Popups spawn during Enemy.TakeDamage; hard limit cleanup happens after adding. Track popup active count and pool instantiate spikes.
Item merger pressure Every enabled item can run MergeChecking and spawn item merger objects. Count enabled item scripts and active merge coroutines.
Boss transition burst Boss flow pools spawn effect and boss after enemy cleanup/camera/UI/music changes. Profile transition frames and object counts.

Open Questions

  • Is there an intended prewarm list in scenes that covers all high-frequency prefabs?
  • Which direct instantiate paths are still used in production combat?
  • Are pooled objects fully reset on OnEnable/OnDisable for all gameplay prefabs?
  • Unknown / needs manual confirmation.