- Home /
Instantiating empty game object - performancewise
Hello,
i know instantiating objects instead "spawning" them from pool is bad for the performance, but i was wondering does instantiating (and destroying) an empty object from a prefab is also a high performance impact operation that is to be avoided?
I plan on using empty game objects that will solely be used as position points for on which the objects will be spawned from pool, then destroyed. Will it cause stuttering?
It's typically best practice to use a pool for things that will be created / removed frequently. In your case, you have an especially simple situation where those objects are empty.
As far as stuttering, it depends on the hardware and quantity of things you're creating / removing. If you're doing 4-5 objects and don't want to spend the few $$anonymous$$utes implementing pool, then you're probably not going to see an enormous difference.
Answer by Oshigawa · Oct 17, 2017 at 05:34 PM
Yeah, basically only few objects sometimes. Thanks, i'll try it out and see what the profiler says :)
Answer by yetyman · Jul 14, 2019 at 09:58 PM
hi. @Kruko Your reply to your question is unclear. was it beneficial to pool empty gameobjects? i am similarly interested in the answer
Yes it was. After few years of using Unity now i see that using empty game objects solely for getting transform.position is quite stupid, let alone instantiating them. So yes, if you really need to create a game object only to get its position, spawn it from a pool, because you WILL create GC calls from instantiated objects.
Your answer
Follow this Question
Related Questions
Spawn Prefabs 1 Answer
How to instantiate a prefab with a script attached? 2 Answers
I cant delete multiple instantiated prefabs 0 Answers
Instantiating to gameobject.transform.position 1 Answer
Retrieving GameObjects from a Prefab 1 Answer