Search code examples
unreal-engine4game-developmentblueprintunreal-blueprint

UE4: How to cast to another blueprint?


I have a UI widget elevatorButton6. When player press the button on this widget, I want to launch a bluerint bp_elevatorButton6, but I can't cast to it

Widget: enter image description here

Here I use interface bpi_elevatorButton: enter image description here


Solution

  • On your GetAllActorsOfClass drag a node from Array and use GET node (with index 0). If you have only 1 BP named BP_ElevatorButton6 spawned in world you are sure that index 0 will return that object, if you have more then 1 it will return first that was found. The node from GET will go into Object node in CastTo BP_ElevatorButton6

    EDIT: corrected some typos