Search Unity

Is there a way of treating a canvas as a shader

Discussion in 'Shaders' started by Laurens109, Jun 16, 2017.

  1. Laurens109

    Laurens109

    Joined:
    Apr 15, 2017
    Posts:
    26
    Is there a way to treat the unity canvas (and all of it's child UI objects) like a shader for a material?

    Example of my problem (canvases won't act like the white plane blocks that hold a shader):
    -
     
  2. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Can you explain some more what you're trying to achieve? I see the video, white boxes, a canvas or something floating around but I have no idea what you're trying to get it to do.
     
    Laurens109 likes this.
  3. Laurens109

    Laurens109

    Joined:
    Apr 15, 2017
    Posts:
    26
    I SOLVED IT!

    Well I was trying to make a node viewing system, a in world placed gameobjects representing nodes from my nodegraph.

    Each of these nodes is a canvas containing two different views (UI panels):

    - A simple view, only shows some text and a background.
    - A detailed view shows the text on top of the panel and lets you peek through it. Peeking through the node makes it possible to seen the invisible childnodes. The peekinghole in the node is actually an plane mesh containing a shader that will show all shaders that from a special type.

    The frontobject (I was rotating around) is a detailed view node

    The white boxes are example plane meshes with my specific shader makes it invisible (unless you look through the other shader, that is used for the peekinghole). Only purpose was testing the shader for the childnodes.

    The grey boxes in the back are simple views of the childnode. These are canvases (Without that special shader asssigned, because I didn't know how to)

    I SEEMED THAT I JUST NEEDED TO ASSIGN THE SHADER TO THE MATERIAL VARIABLE OF AN UI ELEMENT (LIKE THAT FROM A UI/IMAGE OR UI/TEXT)
     
    larku likes this.