Progress bar going up when an enemy AI is close to you, and goes down when the enemy AI doesn't sense you.

Hello, I am quite new to the Unreal Engine scene. But I would like some assistance.

So I have been trying to create this “mechanic” where there is this “Meter/Bar” and this particular bar is when an enemy Ai gets close to you, the “bar/meter” goes up, if the enemy AI can’t see you or is too far, the “bar/meter” goes down to 0.

I have tried certain methods using videos explaining the Stamina and Health widgets. But I still can’t seem to connect both the enemy Ai to the bar and also to the player.

Some assistance would be greatful!

you could make a float variable in your game instance (BarVlaue), then cast to your GI and set the variable from anywhere (e.g. the enemy which has the sense… can sense = cast to GI and set float) then in your UI cast to GI and GET the variable or just bind directly from the GI