What is the difference between spawning an Actor from code during gameplay vs placing the Actor in the level editor before starting the game? Does it affect the game performance in any manner?
Spawning an Actor during gameplay vs Placing an Actor in level editor
It depends how you do it. Some of the benefits of spawning them during gameplay are:
- Less objects in the scene by default
- Easier to create ISM’s when spawning (using one ISM base)
- Quicker to create things like “random location/rotation”
It can mean a slight pause while the actors are spawned though.
I also observed that for Actors that are spawned during gameplay, the first time I launch the game in the editor, the Actors are spawned without any textures and the shaders start to compile during gameplay. After a few seconds the textures for the Actor meshes are loaded. This happens only during the first time I run the game and from the second time onwards the Actors are spawned with the appropriate textures. Does anyone know why this happens?
The materials won’t be compiled until they are added to the scene. You can fix this by adding one fixed copy of the static mesh/es to the scene somewhere they’re not seen (I add them below the landscape at 0,0)