Why is my casting failed in my level blueprint?

Hi! blueprint noob here :wink:
I am trying to activate custom event in my AI character’s blueprint,
by triggering a trigger box in my level. (through level’s blueprint)
and of course, the trigger should be overlapped by game character.
so just like the screengrab that I attached,
I casted trigger box’s overlap event onto my AI character’s BP, and called custom event
that I wanted. Nevertheless, Casting is keep on failing.
What is the cause of this? Any help would be really appreciated. thanks!

Should it be connected to ‘overlapped actor’? ( not at a machine right now )

Still not working! thanks for the reply anyway.

Then it’s not a BP_Hankung.

2 Likes

You could try to get the name of the Actor and / or Component that is overlapping with a Print String … just to be sure that it is a BP_Hankyung.

3 Likes

get the name of the class to be sure

image

2 Likes

Have you check if both the trigger box and your character has Generate Overlap Events set to true
image,
and have your character’s collision object type to overlap with the trigger?

actor/component that is overlapping with trigger is my player character, not BP_Hankyung. Maybe I am using “casting” in a wrong way? BP_Hankyung is totally separated AI character, I just want it to run certain event when my player character overlaps with box trigger.

That’s been checked. thanks!

The Cast node only checks if the overlapping Actor is - indeed - BP_Hankyung and - in your case - will fail, because the Player Character is overlapping.

You need another way, another reference to communicate with your BP_Hankyung.

So, after overlapping you could do one of these:

  • Get All Actors of BP_Hankyung class: Not the best solution to that, but it really depends on your needs.
  • Create a reference to the BP_Hankyung directly in the Trigger Box actor
    (Create a variable with type BP_Hankyung, make it instance editable, pick the actor in the scene)
  • Event dispatcher

This video really helps to understand the communication between blueprints:
Blueprint Communications | Live Training | Unreal Engine - YouTube
(quite long but totally worth it … I have to re-watch it every now and then :nerd_face:)

1 Like

wow! thanks for your detailed reply. as well as others who posted a reply. And I will definitely check that video. :slight_smile: