How to set cull distance on dynamically spawned meshes inside a blueprint?

I have a dungeon generator that spawns some tile blueprints during runtime. The blueprints it spawns are just movable mesh components laid out in various ways. The game can start to slow down pretty a lot as I spawn more but i noticed if the camera is by the edge or these tiles pointing out to nothing the frame rate is fine so i guess the view culling is working it’s magic for me there. From this I decided to set up culling using a cull distance volume but it doesn’t seem to affect the meshes in the blueprints I spawn and I can’t see anywhere else to set the cull distance for these meshes.

So my question is…Is it possible to have meshes inside a blueprint component cull at a certain distance?

Hi mrcrocker -

You can set up a distance check between your spawned items and the Player’s Pawn which could function as a check condition in order to spawn and again if the player moves outside the set distance you could then destroy the spawned items only to have the return if the player returns. This method could be some what costly as you are running Event Ticks which do the distance calculation from the actor to every possibly spawned component. Without knowing exactly how you are triggering your spawned elements, its hard to say how to best integrate a check like that into your blueprints.

Let me know if I can elaborate further -

Eric Ketchum

Hi Eric,

Thanks for the reply. Because of the way the level is generated I don’t think what you suggested would work in this case but it’s definitely an interesting idea that I’m sure will come in handy somewhere else down the line.

The type of game I’m making is top down random dungeons so the camera is positioned similar to in the top down template. After play testing it some more I found that the camera view culling alone was actually more than enough to keep a frame rate of 120fps (even with more meshes/blueprints being spawned than the game would actually need). So since the camera won’t move in my level I’m good to just leave it as is.