Get New Actor Location When Spawned?

I have a flag that I collect once its collected its destroyed and respawned on predetermined locations on the map, I have an arrow BP that is supposed to point towards the flag but it will only get where the flag is spawned first, once its been collected the first time it won’t update to the new location.

This is the bp I have for the arrow.

I have the CheckFlagLocation trigger when the flag has been collected and I thought that would update the location but it didn’t

Any help would be appreciated thanks!

Thanks for explaining and helping me out that did the trick!

i would use a different method to get a reference to the flag actor as your current setup isn’t reliable or performant. if you use a more definitive method of getting the reference it should also solve your issue of updating.

one way to accomplish this would be to have a script on begin play in the flag that sets a variable in the arrow actor. so psudo code would be something like on begin play → get all of class (arrow) → set flagReference variable. that would allow you to eliminate the get all of class, for each loop, and the cast, in the arrow actor.

I have the CheckFlagLocation trigger when the flag has been collected and I thought that would update the location but it didn’t

let say for a example that you didnt have the event tick node, if that were the case everything prior to your cast would never run. if that were the case then you would have no reference object to cast so it couldnt work.

you do have the on tick there though so at the cast there may be a reference there when the other event is called but its hard to say what it would be or if it were valid. basically its non definitive which is something that you don’t want as it can lead to bugs and odd behavior.

if you were intent on using this setup then you would want your custom event to enter the script at the same place as the tick so it could better establish references. however as you will see in my answer below i would change your method a bit.