Can't get 'Set Actor Active' or 'Hidden in game' to work

Hello all,

I have two levels connected. Depending on how the first level is completed, an array of booleans is filled in in a certain way. In my second level, I want the array of booleans to determine which actors are active. I have checked that my first level is working correctly and the array is filled properly (most likely - i print a ‘hello’ message for every item that should be active in level 2 and this is working correctly). The problem is that no matter what I do with ‘set active’ and ‘set actor hidden in game’, the actors I want hidden will not be hidden. Blueprint below:

Basically I store my ‘boxarray’ in the gameinstance, retrieve the value of the boxarray according to the index of the actor i want hidden/displayed, then set whether it is hidden or not. But it is always visible by default, even though the boxarray contains both ‘true’ and ‘false’ values.

what actors are you trying to set to hidden? currently the only actor your setting to hidden is the cockblock one. in every way i look at this script it just doesnt seem quite right, either not correct or not optimal.

Just noticed the name of the actor LOL (it’s a private project), the actor I am trying to hide is the mesh component, which is a child of the actor blueprint.

Any help would be nice, HOWEVER I have figured out I can just teleport the actor out of sight, which is as good as deactivating it. But this problem is bugging me.

the way i would go about setting the actors to hidden would be through using an array of actors and use a for each loop. now theres several ways to do this but the two that come to mind first would be to make a array in the level blueprint by getting references to the actors or make a actor that stores data and does the script. in both cases you will need to have a variable in the game instance to tell the scripts which array you want to use. this variable will be coupled with a select node to actually select the list. you will also need to use a for each loop.

making an array from actor references in the level blueprint is probably the most straight forward and simple as you just need to select the actors in the level then go to the event graph right click and look for the get reference to actors. then get a make array node and use a for each loop and a set actor hidden in game node. its easy to understand how it works but its not reusable in different levels and its somewhat of a pain to add actors to.

the next method is a little more complex to implement but it is much more modular and reusable. basically you want to create a actor that will hold all of the information (array lists) and script that you want to execute. you will want to create an array of the type actor, name it and make it editable, repeat this step to create however many lists that you want. then when you drop this actor into a level you can just select it and populate the values of the arrays in the details panel via a dropdown list. its much easier to add and remove actors on the fly. also with it being a blueprint actor you can do the same thing in each level and just change what actors are in the array.

aside from the way of populating the arrays both scripts will basically be the same. i probably didnt explain it very well but if you look at the pictures it shouldnt be too hard to get. the aim with what i proposed was to get a list of which actors need to be hidden with a reference to each, then use a loop to hide each one. personally i like method two since its simple and reusable. you also may need to tweak the implementation to suit your needs.

Thanks very much I will bear it in mind for future.