Camera not rendering dynamic (spawned) actors?

Hi,

I have a small problem and I can’t understand why it happens. In my C++ code, I’m spawning an actor in my controller’s BeginPlay() method:

AChild *myChild = GetWorld()->SpawnActor<AChild>(*Child, FVector(0, 0, 20), FRotator::ZeroRotator);

When I run my game (as a standalone, simulate or PIE), I see it in the Viewport and in the hierarchy, but not in the Camera preview. Also, when I possess the camera, I simply don’t see it.

This is weird because if I place actors in the scene manually and hit play, I will be able to see them in the Viewport and in the Camera view, but if I move them in the Viewport they don’t change position.

I don’t understand why it’s not working. Am I missing something here? Maybe an option? I also verified that the “Actor Hidden In Game” option is not checked.

Thank you.

Hello TheLeviaprog,

It may be related to the material / normals on the actor itself. Can you check to see if the normals are inverted? An easy way to test would be to replace the material on the actor with the default material or to set the current material to be two-sided. If the camera is looking at the backside of the normal, that would be why it wouldn’t render.

Hi! Like I said, it only happens with spawned actors, so I don’t think it has anything to do with the normals. I also tried by replacing the mesh by a simple Unreal cube, but I still get the same result of seeing it in the viewport, but not the camera view.

For the sake of narrowing things down, could you try spawning this actor with a blueprint instead? I’ll be looking into the issue further but I can’t think of anything else to try at the moment.

I’m a little confused as to how this got marked as an accepted answer when there is no actual answer here. What did you do to fix this?