How to check if a button left the boundaries of a Viewport in ScrollRect?

I’m trying to make an infinite scroll loop, but to do so, I have to know when does the button goes invisible to the screen. If I learn this, then I can fire an event that would recycle that button, and spawn a new one accordingly.

I was planning to use Raycast on the button target, but couldn’t make it work. Can I use Raycast on GUI? Are there any alternative solutions to see if a button leaves the boundaries of a panel.

Yes you can raycast in GUI. Check here: Unity - Manual: Rays from the Camera and here: Redirect to... title of new-page