if UI masked disable object / if UI not masked enable object

I’m using a Scroll Rect with a mask. I’m not sure how to enable each object that’s not masked and disable each object that’s masked.
Example:
if masked
disable
else if not masked
enable

6962456--820118--collectionmenu.gif

What you want to hide objects like this?

The objects are already hidden by the mask. I want to disable the objects that are hidden by the mask and enable them when they come into view.

This sounds like you want to do object pooling right? To optimise game and get rid of lag? If it’s true then search “object pooling ui” something like that…

I am using Object Pooling for the main UI Scroll Rect. But it uses a Mask to hide the items outside of the Viewport. I want to write a simple C# script that disables the items outside the Viewport from the hierarchy. Then once the items are inside the Viewport, I want to enable them.

I need access to Mask.cs so I can write a script:
(referencing Mask.cs)
if masked (outside of Viewport)
disable this item from heirarchy
if not masked (inside Viewport)
enable this item from heirarchy