I’m not sure how to best approach a problem, so I’m hoping for suggestions. The core problem is that I need a button, but want it to be reusable within multiple larger blueprints, and to produce different outcomes based on which blueprint it is within.
I’m trying to make a nested blueprint. Imagine that the button is in a teleporter_room, which could be spawned anywhere. Within the room is a teleport_button, which I want to take the player to a location associated with the room.
For example, at any point either a “teleporter_room_medical” or a “teleporter_room_engineering” could be spawned.
I’d like to use the same teleport_button in each, but when you hit it, it takes you to “room_medical” or “room_engineering”, depending on where you came from.
To make this, I’ve started with 3 blueprints:
teleporter_room_medical & teleporter_room_engineering both contain teleporter_button as a ChildActorComponent. teleporter_button contains a public var string named Location, and based on its’ value, it will teleport the player to engineering or medical when used. Unfortunately, I don’t see any way to set that string once the teleport_button is added as a ChildActorComponent.
Is there a way to set values on a ChildActorComponent within their blueprint, or is there a way to have a child pull a value from the parent? Alternatively, am I doing this in a dumb wrong way, and should be approaching it entirely differently?
I’d like the solution to be as extensible as possible, as there will be many more room types to support in the future, and a variety of different potential target locations (i.e.: engineering_room_variant01, _variant02, etc). I’d also like to keep each room as a single blueprint, as they should be spawnable as a single unit dynamically.
Anyway, any advice is greatly appreciated.