Regarding the processing of the timing gauge


I am trying to create a 2D fishing game on a smartphone. Similar to the attached image, I want to introduce a feature where a gauge moves back and forth, and if you tap it at the right timing when it’s in the green area, you catch a fish. I’d like the green area to be generated randomly each time. Using a Slider seems like a good idea, but how should I create the green range?

The green area could be an “Image” with the color set to green that you add between the slider’s handle and the background , for the random range you set it via script by modifying the anchorMin.x and anchorMax.x , make sure the layout “type” is set to stretch and everything is zero’d out before you save the UI and launch the game.
I’ve attached the screenshot showing how the setup should look like along with the value to edit.