Download

how do you get a variable from a blueprint's parent when interacting with the child?

hi, i am trying to figure out the correct way to have a global parent blueprint for enemies that i can then make child enemy blueprints based on, and when my character interacts with the child enemies, get variables from the parent, regardless of what particular enemy it is. i tried to cast to the enemy parent when my character collides with a child enemy, as seen below, but that failed.

i know i could do this by casting to every possible enemy type, but that is dumb. also, the parent is just an actor blueprint, and the child is a blueprint i made from the parent. any help would be greatly appreciated! thanks!

Hello,
check the box inherited variables to see your parent’s variables, down the variable list. If you want them from a cast, you have them on typing them as others.

In your situation you maybe fail because you use a controller instead of a character blueprint which would be your enemy_master. You can check the actor type by using a print string for example to see what the other actor is. Then see if you are casting to the right actor. (Casting to parent works perfect for children)

what box ? where ?

The pretty well hidden box.

Thanks a lot, big help!