10000 Actors in UE vs Unity

Hi @all;

I am currently testing performance on Unity and UE.

My test case is as follows:

I spawn a grid of actors consisting of a mesh and a material. I create the Objects in a nested for-loop.

In Unity i can spawn 100 x 100 prefabs no problem and get a decent framerate of around 50 to 60 fps animating their Z-position. I use instantiate(prefab) in c#.

If I try that in UE with SpawnActor(), not only does it take a long time to start up PIE with only a grid of 20x20 (400 Actors), but it downright freezes the Editor and shuts down after a while with a grid of 100x100.

My Question is, why is this happening? Or is my understanding of SpawnActor and the way UE handles Objects in the Editor incorrect? Should I use UInstancedStaticMesh? Which one is comparable to Instantiate in Unity?

This would depend if the actors are instanced or unique. Instanced actors share a lot of properties, so they are way more performant. You should check if you are using instanced objects in Unity. Also if you are using blueprints with for loop, that would be way more performant than if you do it in C++.

1 Like

Actors in UE and Prefabs in Unity are tremendously different. The Underlying Code for any UObject is already much larger than any Unity object, so comparing the two is… well atleast not really fair or use case independent

1 Like

I create my Objects in unity with instantiate.
From the Unity Docs:
Returns The instantiated clone.
Description
Clones the object original and returns the clone.
This function makes a copy of an object in a similar way to the Duplicate command in the editor.

As far as I understand it, it is a unique Object with its own components.
So basically the same thing SpawnActor() does.

I create the actor with its components in c++, but I make a BP of it and spawn that BP.
I have to use c++ for the code that spawns the actors and manages the calculation of the position on the z-Axis to confirm that the used code is as similar as possible to my code in c#…so I cant use BP for the loops.

Hm. Didn’t realize that until now. Thanks, I will look into that.

Also look into if the actor or it’s components has tick enabled. This can be a major frame rate killer. Reduce tick counts to zero and I’m sure your frame rate will improve