Light Components still visible when actor set HiddenInGame

I’ve experimented with meshes, lights, and particle systems. It seems like lights stay visible for some reason when the actor is hidden in game.

I also tried messing around in the component editor and clicking the hidden in game checkbox to off still makes the light visible in game. Only setting the component completely invisible by setting visible to off makes it totally invisible.

Are you referring to blueprint’s component editor? If that’s the case I believe hidden in game refers to the editor widgets. You will have to disble it via event graph by setting enable to false.

As I understand, HiddenInGame applies to everything.

There’s also the C++ method and Blueprint Method to set the actor hidden in game. And the expected behavior happens for me when I call it, hiding the actor, but the light components still remain “visible” by lighting the scene even though the actor is hidden while other components are no longer visible.

Hey illYay -

Lights are not really actor components in the way a Mesh is. Lights if visible in the level will have their information passed into the lighting render pipeline. As a work around however and assuming that you have set the light to movable, you should be able to make the light’s Visible setting in Rendering to false and it will disappear from your level.

Thank You

Eric Ketchum

  • “set visible” is not available on runtime for light components
  • “actorHiddenInGame” has no effect at all
  • “affectsWorld” also not available
  • I tried to set intensity to 0 and remember the original value. But there is no “get intensity” also?!

WTF, seriously. Im searching for a simple method to switch a light off and on for over an hour now.

EDIT:

That’s my ridiculous workaround for that currently (had to access the point light component directly for it):


Please tell me, that there is a simple solution for that, also. That’s so horrible.

Hi -

Here is a sample map using Visibility Toggle. (One Node on Key Press)

Test_Project

Thank You

Eric Ketchum

For anyone who has a problem like this, this may work for certain situations.

Instead of calling the actor’s SetHiddenInGame, call GetRootComponent. Then call SetVisibility on that and check “Propagate to children”. If you are having problems with a light component as the root then try using something else as the root and make the light one of its children. You can try a Default Root Node, or if that doesn’t work, try using something dinky you can hide, like a collision sphere that’s got visible unchecked.

Thank you very much. That works perfect!
MyActor->GetRootComponent()->SetVisibility(false, true);

Maybe they aren’t attached to the actor? If you don´t have the light inside the actor’s blueprint, you’ll have to hide them separately. Also, in the viewport you can hide the mesh but not the light, be careful.

If you wanted to switch off the light, you can’t. You’ve to set its intensity to 0 the way the previous person did

Hope I helped

Seems like this could work well in most cases.

I have a somewhat interesting setup where I have some components I want permanently invisible. For example the static mesh I use for physics collision on a gun when it’s on the ground that has a skeletal mesh model strictly for animating. It might have other arbitrary things attached like lights and particles and whatnot.

I’d assume Actor SetHiddenInGame would properly hide the whole actor if needed but preserve which components are visible or hidden, so that setting Actor SetHiddenInGame back to true preserves that. I’d have to double check, but based on the code, this might be how it works.

For this reason, I’d actually prefer to use SetHiddenInGame on the actor and hide the lights as well without extra work.