How to get a looped behavior?

JohnThicc

Member
I need an enemy to to engage the player if they're in it's line of sight, but as soon as they leave their vision, go do something else and then engage the player again if they re-enter their line of sight. Need this to cycle throughout the enemy's lifespan. I have a graph that kinda works, except nothing gets checked each frame to determine whether or not the player can be seen, even though I have a repeater node (It's set to run forever and "End on Failure" is unchecked). Any help would be greatly appreciated. Thanks!


1672547055565.png
 
Last edited:
Fixed the issue. Turns out the enemy's own collider was interfering with "can see object". Solved it by adding a layermask to the Linecast in the "Can See Object" script so it ignores the Enemy's layer. Also set both sequences' abort type to "Both"
1672557005665.png
 
Last edited:
Top