Field of view visualisation (stencil shader) for canvas, instead of only materials?

Hey guys,

I have been working on a 2d pan/zoom navigation for visualising nodes. It works with these three steps:

  1. Select a node viewable node
  2. Load all nodes in this view (show in the “simpel view”)
  3. Load the “detailed view” (and loads the “simpel view” for child nodes), when moving the camera inside the boxcollider of the node! In the detail view you can look through the node to see it’s childs (this using a stencil shader) [Figure 1: Green collider]
  4. When the camera collides with the node view (this is a canvas), load the collided node as the new viewable node. [Figure 1: Blue collider]


Figure 1: nodes.png

I found a way of peaking through a node like if it was a window (this way you can see the childnodes). This solution comes from Sebastian Lague video about stencil shaders. Sadly this only works for materials and not the canvases. I have added a visual support (an MSpaint representation of the situation saved as a .png)

Does anyone know how to show only the canvas and materials, when looking through a stencil shader? Coz currently I can only hide other shaders and not the canvas.

I already fixed my issue. Seems like shaders can be applied to UI components (as images and text).
These UI components have a material variable. :"D