- Home /
UI Masking a GameObject
I'm working on a UI ScrollView to select tiles in an editor. I've got a Mask so the button are clipped properly but as you can see in the image the GameObject over the button is not clipped. How do I have them clipped properly in the UI?
Answer by Hearthdale · Jul 25, 2015 at 06:21 PM
I had this exact same problem, here's how I handled it. It may be a Pro Only approach. I created a Render Texture for each element in my menu that referenced a 3D object. I then set up a new camera for each of them out of the way so that the new camera only saw the 3d object I wanted to render. I took out Audio, Flare, and GUI from the new cameras.
Okay,
On the UI I created a RawImage. I set as its texture the Rendered Texture I created. I then assigned that same Rendered Texture to the new camera viewing the object I wanted to see and Poof!..It showed up.
And I could scroll with clipping!
This may not be ideal for your situation. But it worked for me.
Hope this helps.
Enjoy,
Answer by Thorny2000 · Jul 25, 2015 at 07:04 PM
You should be able to do it with a UI Mask.
Have a look at this video: https://youtu.be/MWOvwegLDl0?t=418
No, he's asking how to mask a gameObject, not a UI Image.