Combining masking and layers not working for picked sides

When I add a mask to hide a counter and I’m using a layer to flip between units of different sizes the mask does not function. I assume it’s because the layered units somehow arent considered part of that side. What’s the fix for this?

Fixed this by reordering the Mask and layer functions, putting masking ie. hiding later in the list.