Hi,
There is this eye icon next to each component in World Outliner window that you can use to hide some objects while editing level.
I’m wondering if it is possible to hide actors the same way but from C++? I’m not talking about Hidden In Game parameter as this influences gameplay and I only want to toggle visibility in editor.
Regards, ’
All you need to do is to call SomeActor::SetIsTemporarilyHiddenInEditor(bool bHidden)
If you want to get down to the details I’d suggest looking at the ‘Engine/Source/Editor/SceneOutliner/Private/SceneOutlinerGutter.cpp’ file
2 Likes
Thank you! that is exactly what I asked for.
But now it turns out I’m gonna need something more.
I have two separate actors and I want the visibility of the first one to be dependent of the other one’s visibility.
So let’s say actor A holds a pointer to B, then I tought it will be ok to do like this:
void A::OnConstruction(const FTransform& Transform)
{
B_pointer->SetIsTemporarilyHiddenInEditor(IsTemporarilyHiddenInEditor());
}
but I found out that togglinig visibility in editor doesn’t cause OnConstruct() to be called.
Is there a way to detect the event of visibility change of actor A? So that when I click “eye” icon in editor for object A then I call a piece of C++ code that will set the visibility of actor B.
Or maybe there is another way of achieving my goal?
BTW. Actor B is actually attached to A using AttachToActor() method, if that is helpful.
2 Likes