EffectInstancePool ​
Inherits: RefCounted
Global pool manager for EffectInstance objects and Projectile instances Handles creation, pooling, and recycling of both EffectInstance and BaseProjectileInstance objects This is an autoload singleton - add to Project Settings > Autoload as "EffectInstancePool"
Variables ​
GameHost.SystemHub | system_hub |
Methods ​
EffectInstance | get_effect_instance( effect_def: Effect, originator: Variant = null, target: Variant = null ) |
void | return_effect_instance( instance: EffectInstance ) |
PhysicalProjectileInstance | get_physical_projectile() |
NonPhysicalProjectileInstance | get_non_physical_projectile() |
void | return_physical_projectile( projectile: PhysicalProjectileInstance ) |
void | return_non_physical_projectile( projectile: NonPhysicalProjectileInstance ) |
Constants ​
intMAX_POOL_SIZE =500 # Maximum instances to keep in pool- ========== CONFIGURATION ==========intINITIAL_POOL_SIZE =50- Pre-allocated instancesintMAX_PROJECTILE_POOL_SIZE =400- Maximum projectiles per VFX typeintPROJECTILE_POOL_CLEANUP_THRESHOLD =500- Clean up when total projectiles exceed this
Variable descriptions ​
GameHost.SystemHub system_hub ​
The hub of the game systems.
Method descriptions ​
EffectInstance get_effect_instance( effect_def: Effect, originator: Variant = null, target: Variant = null ) ​
Get an EffectInstance from the pool (or create new if pool empty)
void return_effect_instance( instance: EffectInstance ) ​
Return an EffectInstance to the pool for reuse
PhysicalProjectileInstance get_physical_projectile() ​
Get a physical projectile from the pool
NonPhysicalProjectileInstance get_non_physical_projectile() ​
Get a non-physical projectile from the pool
void return_physical_projectile( projectile: PhysicalProjectileInstance ) ​
Return a physical projectile to the pool
void return_non_physical_projectile( projectile: NonPhysicalProjectileInstance ) ​
Return a non-physical projectile to the pool