[Question] Changing mobility for Components in Blueprint

Is there a way where I can change certain property ( e.g. Mobility ) for SceneComponent via Blueprint?

Hey Frozenfire,

Scene Components don’t really have a lot of properties, but you can certainly adjust most of them. Location, rotation, and scale, as well as basic visibility and activation, can all be set via EventGraph. Drag off a Get of your SceneComponent and you’ll have a full list of what you can do with it (if you have Context Sensitive ticked).

Mobility is not something you can change during run-time. Is there a specific purpose you have for that change? If you’re looking to make an object movable in your game, you can play with physics aspect of mesh via Blueprints instead.

Hope that helps!

@

I’m this specifically for 3 reasons;

  1. I’d like to know if it’s possible to spawn a ‘static’ object on runtime that persists that’s level saving. Thus having static lighting. I’m making a procedural building but I’m wondering how would I make it possible that generated mesh will have static lighting ( assuming that they would only be generated in editor and not in-game ).

  2. For scenario as described in point 1), I am looking for a solution that would allow me to spawn a StaticMesh component that does NOT cast dynamic shadow.

  3. On a less important note, I am also looking to have an object be static and have baked lights, but would like them to be moved during run time on an on-demand basis ( e.g when shot at ). When this happen , i suppose static objects will not take advantage of dynamic lighting I guess? Would this be correct?

Hey Frozenfire,

Your answer lies mostly in your last question. Static mobility is reserved for objects that do not move or otherwise update in any way during gameplay. Static Meshes will have their shadows calculated ahead of time. If you intend for it to move at any point during gameplay, static lighting on a mesh would not work, and that’s what dynamic lighting is for.

So to answer your first questions, mesh you’d like to remain persistent would need to be placed in its position at level load and dynamic lighting would apply its shadow. You can play with what types of shadows mesh casts or does not cast by creating a Blueprint from your mesh and assigning its lighting properties from Details > Lighting tab in mesh component.

There’s a basic overview of mobility settings in our documentation here:

and some great lighting information here:

Hope that answers your questions!

Hi @

Thanks for answering most of part.

Specifically on 2) , I am not referring to pre-placed components. I’m referring to components that are being spawn during runtime construction script.

This is script that I’m doing .

It generates window on runtime but it always cast shadow and I have not found a way to disable it via blueprint.

Hey Frozenfire,

I responded to your bug report here:

See if that solution helps fix lighting problems you’re experiencing when spawning Static Meshes through your Construction Script.

For your other questions:

  • In same way, by making adjustments in Details panel for Add StaticMeshComponent, you can expand Lighting section and disable Cast Dynamic Shadow.
  • Since you can’t change mobility at runtime, you won’t be able to move an Actor with mobility set to Static. You might be able to replace it with an identical Mesh set to Movable, but you’ll need to experiment with that to see if you get lighting results you’re looking for.

Hope that helps!