Actor saved from array changes when array changes?

Hello, I’m running into a strange issue with a Blueprint, and it has me completely stumped.

Basically, when I press a key, my player controller is getting the first Actor from an array of Actor Object References on one of its pawn’s components, and saving that reference to its own Actor Object Reference variable, as below:

The Lockon Spotter component that this reference is being obtained from clears the Sensed Actors array every tick and fills it with any actors from a list elsewhere that are within a specified range. The problem I’m having occurs when I’ve locked onto an actor, and then move to no longer be in range of it, meaning it would be removed from the Sensed Actors array, and at this point Lock on Target changes to either some other actor that is still in range, or None if nothing is still in range. But there is no code changing Lock on Target at this time, so I have no idea why it’s changing or how to prevent this behavior. To the best of my knowledge, I can’t see any reason why changing the array would change the object reference I’ve stored in a completely different script, unless it’s somehow storing a reference to that index of the array instead of the actual object in it? But I can’t seem to find any information indicating that this would be the case or how I would change it if it is…

Any guidance would be greatly appreciated, as this behavior seems completely different from any language I’ve ever worked in, so I’m pretty well stumped…

This change would not occur, I have think maybe you have a fault in your debugging process.

Try printing the name after assignment, and maybe have another key to re-check that name…

So, I figured out the issue, and it was a classic case of PEBKAC on my part…

The class also had an InputAxis to allow switching to a different target. It turns out, I forgot that InputAxis events run every frame and if you don’t want to do stuff when the axis value is 0, you have to explicitly check for this condition…

So yeah, oops… sorry for wasting your time.