I’m trying to figure out the best way to create a re-usable room actor that is composed of several other actors. I’m not sure if this is the right way to go about this - what I’m tying to do (just for the sake of figuring out how) is create a maze type game created of repeating intersections and corridors.
I want to have one intersection “object”, which I assume should be an actor. I want to be able to customise this one object, so that if I want to adjust, say, the light in each section, I only have to do it once. Now, this I can see how to do using an actor, and is not causing a problem. However, for more complicated components within the actor, I am having some trouble. For instance, each intersection will have 4 doors:
Because the door is repeated four times, but all doors should share a basic behaviour and set of controls, the door is itself an actor blueprint:
The door actor has an editable variable “open”, that decides whether the door is open or shut during construction. This allows me to change the doors status in the editor, and see this status before launching the game. For the purposes of this game, this would allow me to manually create a path of open doors that I can see in the editor before launch.
As seen above, this works great when I directly place the door actor into the level. However, if I try to make the door actor a component of my 4-door “intersection” actor, I can no longer access this variable:
I am placing the door actors within the intersection actors as “Child Actor components” - is there a different/better way to do this. I have tried shifting the input code to the “intersection” actor itself, and while not ideal I can duplicate the open/closed boolean there as editable and pass it onto the child door actors. However, I cannot find a way to pass this variable onto them before/during construction, so even with this workaround I can’t actually see the doors change status in the editor - only once the game has started do these changes take effect, which is not ideal.
While I could just create each door individually within the “intersection” actor, this strikes me as being a bad move in terms of code reuse etc. - say I want to later add in a fairly simple open/close animation with a trigger volume to detect the player. Using a separate door actor, I only need to do this once. If the doors are composed individually within the “intersection” actor, then I would need to do this once for each door.
In short, I think my questions are:
- Is there a better way to reuse actors within other actors, to build more complex actors out of many individual ones?
- Is there a way to access a child actors editable variables in the level editor? If not, is there a way to set these variables from the parent so that the changes take place before/during construction?
Thanks to anyone who can help. I’m sure there’s something simple I’m missing, but I just can’t figure out how to do this.