Spawned BP Static Mesh Actors Dont Cast Shadow in PIE or regular game, But Do In Editor Itself

It should be noted that Static Mesh Actor BP’s that I drag into the level have shadows in editor view, but in PIE those dynamic shadows (pre lightmass) go away.

Dear Friends at Epic,

Hi there!

So being able to dynamically spawn static meshes is integral to my game, which includes a build in level-editor.

In UE3 I could easily spawn static meshes that would cast shadows properly.

In UE4, I can spawn static mesh actors from my BP and they have collision and all.

And in the EDITOR they have shadows, including casting shadows on each other.

But, in PIE, and in the independent game launch, when I try to spawn the static mesh actors they do not have shadows.

In the BP itself all shadow options are set to true.

Any idea how I can get spawned static mesh actors to cast dynamic shadows like they did in UE3 ?

I tried re-setting shadow casting after spawning the BP in C++ code

//shadow
newWall->StaticMeshComponent->SetCastShadow(true);

:slight_smile:

They cast shadows in the editor, but not in PIE

In PIE and in the Independent Game Launch (right click on project in file browser)

I can upload my extended Static Mesh actor and BP if you think that would help to figure this issue out.

Thanks for the help as always!

Rama

PS: to clarify, I am just spawning the BP static mesh actor in code, all properties are set on the BP in the editor, which casts shadows fine in editor view, but in PIE even the BP static mesh actor does not cast shadows without lighting being built.

but I need dynamic shadows to work, without lighting being built, as part of my core game mechanics.

Hi Stephen!

You’re awesome!

Actually after doing some tests just before responding to your question I realized it was actually the material itself that was dissolving all the shadows and making it seems like the static mesh actor was not receiving shadows from player, but only casting them.

It was a material I based off of the aluminum metal from the trike material demo.

But all is well now, now that I know it’s just the material,

thanks for asking and causing me to check it out!

:slight_smile:

Rama

Glad to hear! … I work in mysterious ways. :wink:

I just wasn’t able to reproduce the problem, so I wanted to know if you were taking any special steps. Which, in a way, you were.

Cheers!

Do you spawn static meshes, or static meshes encapsulated withing Blueprint ? (data onlue blueprints).
if it is former then:

Did you added you static mesh component as root ? If that’s the case it won’t cast shadows.
Try adding blank components first (like arrow, box or other shape) and after it add your static mesh.

I believe it was reported bug earlier than static meshes procedurally spawned trough blueprint, doesn’t cast shadows, I dunno if has been fixed yet.

I had to spawn the static meshes from a BP where they were set to Movable, not static, then they cast shadows

I’d still like it if the player cast a shadow on the static meshes though, because that would make my platforming gameplay a lot easier.

So I’m still putting in a request for Moveable Static Mesh Actors to receive shadows from player character

Thanks Epic Devs! You Rock!
:slight_smile:

Hi Rama,

Would you mind walking through the basic layout of your blueprint so that I can attempt to reproduce the issue?

Thanks.