Key-based object pooling for Unity that replaces Instantiate with one call and learns how many objects your game needs, so heavy moments don't instantiate anything.The pooling code is pipeline-independent and works with Built-in, URP, HDRP and custom render pipelines. The demo materials use URP Lit and appear pink in Built-in or HDRP projects; assign your own materials there.Instantiate and Destroy in gameplay cause spikes and garbage. Smart Pooling replaces them with a pool that needs no setup in your scenes and prepares itself from how your game is actually played.Key featuresKey-based pools: add a Poolable component to a prefab, give it a unique key and call PoolManager.Get instead of Instantiate. No pool objects to place in scenes, no setup code.Smart prewarming: the highest number of objects in use at the same time is recorded per session, and the average over sessions is created when the game starts, so the first heavy moment doesn't instantiate anything. Fixed initial counts and PoolManager.Prewarm are available too.Survives scene changes: returned objects are parked under a DontDestroyOnLoad root, and PoolManager.LoadScene returns everything first, so nothing is destroyed with the old scene. Additive scenes and persistent owners are supported.Safe by design: objects are reset to their prefab transform on return, stale timers can't return objects that are in use again, and PooledRef tells you when an object you hold has gone back to the pool.Fast: Get is O(1) and allocation-free after warm-up. Components can be cached per object with Get.Editor tools: the Pool Manager window keeps the smart pooling registry up to date, validates keys and, in Play Mode, lists spawned, free and active objects for every pool. Clear console messages name the cause and fix of common mistakes such as destroyed pooled objects, key collisions or missing settings.How it worksAdd a Poolable component to a prefab and give it a unique key.Get an object: var bullet = PoolManager.Get(bulletPrefab);Return it: bullet.SendPool(), bullet.SendPoolAsync(2f) or enable Auto Destroy on the Poolable.What's includedRuntime and editor code with their own assembly definitions (ShawkStudios.SmartPooling, ShawkStudios.SmartPooling.Editor)Pool Manager window and Pool Settings assetDemo scene with prefabs and scriptOffline documentation (PDF)AI Instructions.md: a usage guide for AI coding assistantsRequirementsUnity 6 (6000.3) or newerRender pipeline: any, the pooling code has no rendering code; demo materials use URP Lit and appear pink in Built-in or HDRP projectsDependencies: none (pure C#); works with Enter Play Mode Options (domain reload disabled)Documentation and supportOffline documentation (PDF) included, also opened from the Pool Manager window.Support: Discord (link in the Pool Manager window).Updating from 1.0: existing prefabs, Pool Settings and smart pooling data keep working; script GUIDs, serialized field names and the save file are unchanged. Version 2.0.0 requires Unity 6.This asset was developed with AI assistance and reviewed by Shawk Studios.Namespace and assembly: ShawkStudios.SmartPoolingMenu: Tools > Shawk Studios > Object PoolingEvents: OnSpawn and OnPooled UnityEvents on every PoolableSmart pooling data: Application.persistentDataPath/shawkPooling.jsonWorks with domain reload disabledDocumentationDiscordVersion 2.0 code, documentation and store images were produced with an AI coding assistant (Anthropic's Claude) under Shawk Studios' direction. All changes were reviewed by Shawk Studios.




