You should be using “GetHUD” and connect “GetPlayerController” to the player pin. Connect that to the cast node and it will work
I’m trying to use a custom event to print text on the players screen when they enter through a box collision. I’m trying to cast from the box collision BP to the FirstPersonHUD BP where I have the custom event to trigger a draw text function. However I’m unsure of what to plug into the object pin for cast to FirstPersonHUD.
I’ve attached the other actor pin to the object pin on the cast to FirstPersonHUD function, and all seems ok with no errors. However when I test it in the level no text is printed to the screen when the player walks through the collision box. Does anyone know what I am doing wrong? Or a better way of doing this?
Yeah, when using HUDs all continuous HUD updates need to be connected to the ‘Receive Event Draw HUD’ event in your HUD class.
Thank you, I tried setting it up like that, however when I test it in the level I get this error in the message log:
“FirstPersonHUD_C_0 Canvas Draw functions may only be called during the handling of the DrawHUD event”
You could use a Bool, that is called something like “HasGameEnded” on your HUD class and set it to true when your event is triggered, and then connect a Branch node to Recieve Event Draw HUD that if true changes what you need on the HUD.
Another option would be to use Widgets(UMG), which are newer and more advanced then HUDs. They will totally be able to do what you are looking for with ease. If you are for some reason requiring that you use HUDs than I will gladly still help you out though.
I would like to learn how to set it up using the HUD. Could you explain more how to do it more using the Bool and Event Receive Draw HUD? I have the Boolean variable now, but I’m not sure where I’m supposed to attach it to. Thanks.