So I am trying to bind an event dispatcher (KeypadPanelLightOn) that is in another blueprint (ButtonKeypadX12) to this, another actor Blueprint.
I have set an actor variable for the other blueprint actor (KeypadX12Var) and plugged it into the ‘Cast To’ Object - It compiles ok but I get the blue ‘Cast To’ note at the bottom as seen in the screengrab.
I don’t really understand what is going on and how to get rid of the blue note. I know the ‘Cast To’ needs an object reference and I thought passing the actor ref variable is what it needed. I also get the same result if I try to use ‘Get all actors of class/Get’ from the ButtonKeypadX12 plugged into the object input instead.
I know this gets asked a lot and have watched 3/4 videos on casting as well as gone through many forum questions here but every one seems to focus on casting to a pawn/character, I cant find any that give a clue as to what to reference in another BP. I just cannot get my head around it.
Can someone explain to me in ‘idiots terms’ What object I need to plug in to ‘object’ to reference another Actors Blueprint Event dispatcher?
Just delete the Cast-node? If it’s already a KeypadX12, you don’t need to cast it to a KeypadX12. But if “Object” is a class **derived from KeypadX12 **you may need to cast it (if the variable, function, event or event dispatcher you want to access is in the derived class of KeypadX12).
Oh, of course you need a valid “KeypadX12” reference. The reason why this “works” with the cast node is that the cast fails if the “KeypadX12” reference is invalid (and does not throw any error message). So the “Cast failed” pin is triggered, not the other one and the code behind the Cast-node isn’t even executed.
Yes, before executing this code you need a valid reference in the “KeypadX12Var”. You can set it in the BeginPlay-event (e.g. GetAllActorsOfClass), or by the other actor, or by the level blueprint…