Object being put into "Game" GameObject in Hierarchy

zroc

Member
Justin. During game play there are odds and ends of objects being placed into the "Game" gameobject that never seem to go away and just keep stacking up. An example would be firng the Assualt rifle;- Extra Audiosources of the BulletImpact, Muzzleflash and Shells just keep piling up inside this gameobject after timing out on the root hierarchy. See pic.
 

Attachments

  • ucc_Game_ExtraObjects.png
    ucc_Game_ExtraObjects.png
    38.4 KB · Views: 4
That's the intended functionality. Those are the disabled objects from the object pool.
 
That's the intended functionality. Those are the disabled objects from the object pool.
OK. I figured as much but whats the intention behind it? As I have seen them build up to 200+ over a considerable amount of game-play testing.
 
This page explains it in detail, but basically: constantly instantiating and destroying objects gets quite expensive. Object pooling allows certain objects to be re-used rather than being destroyed and instantiated, although not always for objects like shells. A large number of disabled objects in the hierarchy shouldn't affect performance during run-time anyway.
 
Top