Toggle static mesh actors between static and dynamic lighting at runtime


Using 4.27, during runtime I need to hide furniture and have its shadows on the floor vanish too.
The scene is very heavy and project time restrictions do not allow for any optimisation, so I must bake the scene to get good FPS.

Is there a way to temporarily force the floor static mesh actors to be dynamically lit at run time?

Everything is imported into Unreal via Datasmith and the floor is comprised of dozens of separate meshes. I can easily loop through them in my player character BP but simply setting mobility to moveable has no effect (the static shadows persist).

Even moving the floor meshes slightly (which breaks static lighting in editor) has no effect at runtime.

Thanks in advance for any ideas!

short answer: u cant

1 Like

Thank you for the confirmation, I was wondering this!

I had an alternative idea which I also can’t seem to get working!

What if, at runtime the event creates/spawns a duplicate of all floor mesh actors and temporarily makes the original ones non-visible.

These duplicates won’t have any baked data so should light dynamically, right?

Trouble is, whilst it compiles fine and hides the original meshes nothing spawns.

I have looked online about spawning at runtime and everything seems to direct toward spawning meshes that are inside a BP. Is this really the only way to do it?

Seems to me you are overcomplicating yourself. If you are willing to “swap” the entire scene to dynamic, just forget baked lighting and optimize you dynamic or hybrid scene from the start.

Unfortunately I cant get good FPS with hybrid or dynamic. This is not for a game, it is for an interior space real time presentation.

The required turn around time for this and future projects (all large interior spaces) is 1 to 2 days tops (with changes throughout) so no time to optimise anything at all.
About the only thing I have time for is reducing 4, 8, 16K textures down to sensible levels within UE4.

Surely there must be a way to duplicate a static mesh actor at runtime? :confused:

there are far better solutions for optimizing ur scene.

You’ll have to experiment with the baked lighting, but hope this helps:


Thank you for taking the time to set that up Pezzott1 !

Currently I am importing everything from 3dsMax via datasmith and using meta data from 3dsMax to do a lot of auto organising in UE4 at runtime so I can hide/unhide various categories of objects without having to manually set everything up after each import.
I think I can modify my 3dsMax export process to duplicate the flooring on export and adjust the meta info so UE4 understands which floor version is static and which dynamic. Then I can switch the visibility just as you demonstrated.
So in the end I won’t need to duplicate anything in UE4, just in 3dsMax instead!! :grin:

If you are duplicating, try this: export them only once and in the blueprint create two Static Mesh Components; set one to Static/Stationary and other to Movable, then assign the static mesh you want for that instance.

Assign them at begin play or in construction script.

And you you’ll be able to change them in the editor.

Slight change to the above if you want to go this way:

This way you’ll only need one blueprint and you can swap out everything as needed. You can even have another blueprint trigger these blueprints per room as the player approaches.

Thanks again Pezzott1

Not sure I completely understand everything there!

Where you say:
“export them only once and in the blueprint create two Static Mesh Components”

If I have, say, 40 floor meshes coming in from 3dsMax, then I make 80 static mesh components in a specially made BP, which I drag into my level.
On event begin I do the static mesh assignments and later control the visibility as needed?

Actually thinking about it maybe I only need to make 40 static mesh components just for the dynamic floors. All the static floors are already in level and baked and can be made hidden in game whenever I like.

Hopefully I will be able to automate the creation of the 40 static mesh components in a loop! :slight_smile:

Yes. You dont need to import duplicates as different meshes in Unreal.

Thank you Pezzott1
I will give this a try ASAP this week if I can and let you know how it goes!