Transitioning continuously between two animations inside a state machine

The idea is to make an enemy go back and forth between an attacking animation and a default/idle animation inside a state machine, so long as the player is within range. To do this, I made a Box Collision component inside the enemy blueprint and added an OnComponentBeginOverlap for testing the overlapping of the player character with the collision component. Once that happens, it sets the value of a boolean variable to true. This variable is then called and saved inside the animation blueprint through a cast to use it for state transitions inside the state machine. However, I could not figure a way to make the animation blueprint transition back and forth between the attacking animation and the default/idle animation as long as the overlapping is still taking place.

Hi there! You can use very simple logic: Idle => Attack if player is in range, while Attack => Idle when attack anim comes to end. To do that use Get Transition Time Elapsed (ratio) from Transition Rules | Unreal Engine Documentation