OnBegin overlaps has different value for same actor

Greetings ans salutations,

I’m makeing a aim lock system and i’ve encountered a little promblem. I have set onbegin overlap node for the aiming component to check if its an enemy or not. Everything worked fine as long as there was only one instance of the BP. When I manually put in a new instance, spawning an instance or setting a child BP of the character the aim doesnt recognize the second one therefore telling me false when i overlaps it. Here an image to help you out. I wonder what am i making wrong. Thank you for helping me out.

The problem you are having is that you are literally comparing that one unique to other instances in the hopes that you can find another identical instance. Since each instance is unique (even if they share the same class), this is impossible. You need to compare its class.

Try this instead (of course, change the class you wish to cast to to whatever class your enemy is; Base Enemy BP?), I think you will get better results with it. If the cast succeeds, it also means you have the right enemy class.

Thanks a bunch Cridia! now i understand a lil more when should I use a cast or a referene, thank you very much for the help!

No problem. If you could mark it as an answer, Epic can close it for tracking purposes :wink: