I am trying to mask my in-game minimap. It is proving much harder than anticipated. Here is the basic set-up. (I’ve tried adding Image objects with Mask components throughout the hierarchy, with no success):
:UI Holder
-
Screen Space - Overlay UI (with various button and text objects)
-
ScreenSpace -Camera UI (linked to a UI-only camera which is parented to the main camera)
- Minimap Panel element (with line renderer to draw the main camera’s frustrum on to the map)
I made the minimap panel Camera ScreenSpace because Line renderer won’t seem to work in Overlay, but now the UI mask doesn’t work in Camera Space, so my frustrum line draws across the entire screen, which I obviously don’t want. The manual says nothing about UI mask in Camera space, and the only other relevant reference I can find on the net is from another guy who was saying that UI Mask doesn’t work except in Canvas Overlay.
How do I mask the minimap panel while keeping my line? Am I going about this the wrong way or just doing something wrong?
The minimap panel itself has a texture which I update at run time with an orthographic camera’s render texture snapshot.
I had it working previously in Overlay mode using GLDraw on PostRender, but it seems like it would be better to use the native Unity line renderer? GL Draw was a bit limited when it came to drawing icons on the minimap.