Instantiate prefabs - overhead?

I was just wondering what the general method is to utilize prefabs. The examples suggest instantiating the prefab when they are required for example as in the firing a projectile example in the reference guide.

However I would have though it would be significantly more efficient to pre-create prefabs, store them in an array and then activate them when required.

What do others do?

Thanks.

Depends on the platform; if you’re using a PC you won’t notice any overhead, but on mobile devices (especially older ones), you can see some gains by using a pool.

–Eric

I think because instantiating at run time will significantly reduce processing time also because some thing are only spawned during gameplay. Per say a grenade may be determine by the amount the player have therefore instancing when the player mouse click. This way it is better than to have an array which calculates the amount of grenade the player have, store them in an array and when player clicks and activate which makes things complicated. IMO.
And sometimes like bullet, when i instantiate, i can assign a reference to it to do some other things since Instantiate returns a object which i can use. Hope that helps.

Well I soon reached the ceiling trying to instantiate 50 particles for an explosion effect :slight_smile:

I think for objects that are continually switching on and off precreation is the way to go.