First of all , i apologize for misleading tittle, because i dont know how to describe it.I just started using unreal engine 4.
I have a player actor which has “Target” actor reference variable. The target variable is changed by gameplay blueprint (selected) and I have enemies called “Enemy 1” , “Enemy 2”.
I want to get variable from actor which is in “Target” Variable.
how i can achieve something like that on bottom?
You will need to cast the “Target” variable to your specific blueprint type which has added the “Max Health” variable.
Right now your “Target” is a regular actor and doesn’t ‘know’ about this variable called “Max Health”.
So drag “Target” to an empty space and type “Cast”, in the short list you should find your “Enemy 1” (or Enemy 2 as seen in screenshot) blueprint class, select this then you can connect the appropriate pins (the blue one on the bottom) to your “Max Health”.
i would want make it automaticaly read the variable when its enemy 1 or enemy 2. enemy 1 and enemy 2 has same variables(variable name) and i want them to be read when they are selected.
at the moment you show how to get variable from specific.
If i do thing what you told me, it will only read max health from Enemy 2