I need some advice about structuring my actors in a level
I am trying to make a spaceship cockpit, with lots of buttons, which do lots of different things. So far I have tried two approaches… the first was to create a Spaceship, ControlPanel and Button actors. Using Child Actor Components to put them one under another. I then made a ButtonTarget interface with Pressed and Released functions, and the button calls this interface with its ID. I added a light bulb actor to the spaceship, with the light bulb implementing the interface, turning itself on and off, but I start to run into problems around here since the button needs a reference to the buttontarget interface to call the function. Neither the button nor its parent, controlpanel, know anything about the lightbulb. I have gotten this working, but it was complex to pass the buttontarget reference to the button, and involved a bunch of get child actor and casting every time i wanted to do something.
My second approach was to make the ship, panel, and button as Actors, and drag and drop them into the level. Then I put them in a hierarchy using the world outliner. Same stuff with the interface, but this time when it came to giving the button the butontarget reference, i was able to do this very easily in the level blueprint, just by selecting the button in the world outliner, then in the level blueprint creating a Reference to it, and the same for the lightbulb. This solution is about 20 blueprint nodes simpler than the first approach, and I avoided a lot of casting and reference passing.
The only thing that is worrying with this is that construction of the spaceship occurs in the level blueprint construction graph and would get pretty long eventually. Any thoughts on either approach?
Eventually I would like to do things such as dock with an airlock, use level streaming to load the interior of a space station, and unload the spaceship as the astronaut goes inside the station, loading and restoring the spaceship state when he returns the other way. In addition, I might want to allow the player to choose upgrades, which would mean swapping out a control panel with a newer version (with more buttons which can access deeper functionality). I have not approached either of these areas yet, but can you comment on how it’d impact both of the architectures sketched out above?