Cast failed; Cast to HUD on trigger

Trigger volume is triggering just fine, but the Cast to HUD keeps failing. Am I using the Cast function correctly?

Intended function: On trigger volume overlap (when new area entered), the HUD should display the area and level’s name (currently defined as a variable in the volume).

Current script flow as I see it looks like this:

  1. Volume is triggered starting the overlap event in AreaTrigger.
  2. AreaTrigger convert it’s AreaName and LevelName enums to strings, then sends that info on over to HUD via a cast (maybe this is not how a Cast works?).
  3. HUD prints the Strings in a Draw Text function.

Like I said, trigger volume triggers okay, however, cast always fails.

When I begin play, the HUD displays some test text and the default AreaName text.
However, when I enter the volume, I only get ‘Cast failed’ and the HUD’s text does not change.

Fixed this;
Removed the Cast function completely and stored the variables instead in a Blueprint Interface so I have ‘Entered new area?’, ‘Level name’, and ‘Area name’ in a callable function.
I still have the Enums set on the trigger volume - these are sent to the interface which when used in the HUD gets me my variables! :slight_smile: Below for pics!

I haven’t figured out how to use the Cast function yet, but at least I was able to do what I needed!

I see you already fixed it, but just in case if you want something to cast to your hud it should be connected more like this :slight_smile:

Oh I see - so I was just using the wrong object reference for the input on the Cast? Thank you DD, thats very helpful. Does casting work as I think it does, letting you modify variables in another blueprint from within the current blueprint?

I don’t really know how to explain casting myself, but here you will find an answer that should help you understand it a little bit better: