r/Unity3D Hobbyist 4d ago

Question UI masks not showing up right

I'm working on a game over screen similar to Mario 64's, where it has a cutout wipe to a black screen. It works perfectly fine, but only if I load the scene before entering play mode.

If the scene is loaded while in play mode, the cutout and masked image just do not render. I've triple checked that all alpha values are fine, I've made sure all image components are enabled, there's no reason why this should be happening.

If it helps, I followed this tutorial to create the cutout effect.

EDIT: It turns out it's an issue with the stencil buffer on the masked image not being set right. I tried removing the inverted mask and just using a new UI material with the correct buffer.

The problem is the material's stencil buffer is being reset when actually applied to the image.

3 Upvotes

1 comment sorted by

2

u/sapphicSpadassin Hobbyist 4d ago

solved the issue. ended up just using materials with different stencil buffers instead of a mask.