Can't pass an equals check in blueprint of a character

I am trying to create a homing projectile that targets anything with the tag of target but it never goes after the owner of the projectile. After a player creates the projectile it sets itself as the owner by setting itself to a variable in the projectile blueprint. When I check for what character is the closest I branch away if it isn’t the owner but it’s always false such that the owner gets targeted. Here is a picture of my logic for branching. I’m guessing it has something to do with the nature of the variable but I am lost.


On false it doesn’t do anything but it is always false.
I set the owner after I create it. Does this cause a problem because I call homing in BeginPlay which is the part failing?

Indeed this could be the problem.
BeginPlay is executed during the SpawnActor call, so if you have a setup like “Spawn Actor” → “Set Variable” then your variable won’t be set in BeginPlay.

Generally the natural solution for this is to enable “Expose on spawn” for your variable, then it will show up as an input pin directly within the SpawnActor node, and it’ll be set in the spawned actor’s BeginPlay.

However for this case you don’t need a custom “Projectile Owner” variable, there’s already a builtin, replicated Owner variable which you can set in the SpawnActor node. Simply set the character as Owner, and check with “Get Owner” in the projectile code. No need to cast to character if you’re doing a simple == check.

1 Like

Thank You! I didn’t know that there was a built in feature and I got it working immediately. It was what I suspected where I set the variable after making it.