Author Topic: Instancing substance graphs  (Read 161 times)

What is the correct way to instance substance graphs from c# at runtime or from an editor script?

What I'm trying to do is create many instances of a graph and set their parameters differently.

My current approach is like this, and it works, but I think I'm creating duplicates of all the maps when I only really need the albedo to change

    foreach(S_Card s in allCards)
        {
            SubstanceGraph newGraph = GraphReference.Duplicate();
            newGraph.SetInputInt("Input_Selection", s.myNum);

            s.GetComponentInChildren<Renderer>().material = newGraph.material;
         
            news.QueueForRender();
            news.RenderAsync();
 
         
        }