Search Unity

Resolved ShaderGraph and Vector Arrays ?

Discussion in 'Shader Graph' started by MlleBun, Aug 5, 2019.

  1. MlleBun

    MlleBun

    Joined:
    Sep 19, 2017
    Posts:
    163
    Hi everyone, I made a lot of unsuccessful research on the subject, and (being desperate) I'm posting the question to see if anyone of you could point me to the right direction.

    I'm trying to achieve the following behaviour with Shadergraph :
    • I have two (or multiple) empty game objects placed on some random spots of a single ground mesh.
    • The goal is that each of those game objects hides the area around them.
    The mask works fine on one of the game objects, but I was wandering how to extend this to an array of vectors (so all of my gameobjects). Do you have some advice for me? Should I use Material.SetVectorArray for ex?

    Thank you for help.
     
  2. MlleBun

    MlleBun

    Joined:
    Sep 19, 2017
    Posts:
    163
    Found the trick if anyone is interested!

    Just have multiple materials on your mesh and in C#, point to each of them using the empty game objects positions.Works perfect and no need to use SetVectorArray.
     
    ToxicTree and marcosbiagi like this.
  3. Danielsantalla

    Danielsantalla

    Joined:
    Jan 7, 2015
    Posts:
    75
    Thanks for this writing down here :)