- Home /
Performance overhead for empty game objects
Hi,
Does anyone have an idea on the overhead for empty game objects? Most of the "limits" that people mention in the forums here apply to objects that are rendered, but are there applicable limits for empty game objects, be it absolute, or limited by performance? Asa practical example: Would I run into problems with 1MM empty game objects in parallel?
Thanks!
Answer by robertbu · Jul 09, 2013 at 05:01 AM
Anytime I have questions like this one, I just write a quick script and run a test. Here is my script:
#pragma strict
var objectsPerFrame = 100;
var guitext : GUIText;
private var created = 0;
private var time = 0.0;
private var paused = false;
function Update() {
if (Input.GetKeyDown(KeyCode.A))
paused = !paused;
if (paused) return;
time = Time.time;
for (var i = 0; i < objectsPerFrame; i++) {
created++;
var go = new GameObject();
go.transform.parent = transform;
}
guitext.text = time.ToString("N") + " , " + created;
}
I ran the test on a Windows build on a fairly fast machine with 32 GB of memory. The number of game object made no difference in the frame rate. The app crash at 8.4 million game objects. The frame rate just before the crash was 60 fps...the same as when the app was started. Note the behavior of this script in the editor was substantially different than the standalone app.
Hey, this is great, thanks! Would you $$anonymous$$d elaborating on the specific differences you found regarding editor vs standalone?
In the editor the frame rate dropped quickly, likely due to having to update the Hierarchy View. It took a long time to just get 100,000 object. Note when I paused in the editor view, the frame rate jumped back to normal.
Your answer
Follow this Question
Related Questions
Does inactive Objects eat up Performance? 1 Answer
How can I defer the recalculation of child transforms whilst modifying the parent transform? 0 Answers
large number of identical objects in scene? 3 Answers
Replace GameObject vs. replacing mesh and material? 2 Answers
What's a cheaper reference, GameObject or Transform? 2 Answers