Hello, I’m currently working on a project that requires me to stop rendering large groups of objects based on in game properties. The still need to be able to interact with the environment however. I was wondering if anyone was aware of a good way to go about this? I’m new to UE4 and am not as familiar with all of the classes and features. I noticed that there was a ULayer class, however didn’t see any way to access this during runtime, would that be a possible way or is there a better/different way?
The most simple approach would be to have a check in your code for when you need to stop rendering and use:
SetActorHiddenInGame(true);
Cool, that’s what I was looking for. Is there any easy way to do this to a large group of objects (like putting the objects in a group or something) or do I have to find the objects in script and then iterate over them? Thanks
Not quite sure? How exactly are you grouping your objects in the code? If they are all held in a TArray/Array/List or something you can just iterate through that and set them to hidden.
I was planning on grouping them through the editor and then hiding them in script. The way I’ve achieved this effect in other games I’ve made (in different engines) was having the objects being children of a single object. Then I’d hide the parent object and it would hide all the children as well. However when I tried this in unreal it only hid the parent, not the children as well. I also noticed that unreal has support for grouping objects by layer however didn’t see a way for hiding an entire layer through script. I’m not entirely sure what the best way to group them in unreal to achieve this affect would be though. To give a better description of the in game effect I’m trying to achieve, my game essentially has multiple versions of the same level that are swapped out during game play. All the versions of the level share the same common base (so like they have the same hallways and stuff) however different versions have different additional objects in them (so like one version will have a vase in one location and another will not). The player however still needs to be able to interact with all versions of the level even if they are not visible, hence why I just want to hide it rather than enable/disable the objects. The way I was thinking of doing it was grouping objects that belong to a version and just hiding them when they are not visible. I’m not quiet sure of what the best way of grouping these objects would be though so that way they are easy to group from editor but also easy to get and hide in script. I hope that clarifies a bit more. Thanks a lot for the help!