User Guide Cancel

API Overview | Ecosystem and Plug-ins

API Overview


Substance.Game

Using Substance.Game
Using Substance.Game
Using Substance.Game

Substance.Game is the assembly that contains the classes used for scripting. These classes are as follows:

Substance.Game.Substance: References the sbsar

Substance.Game.SubstanceGraph: Individual graph in the sbsar. (used to be ProceduralMaterial in Unity 2017)

Scripting Process

  1. Create an instance of SubstanceGraph

  2. Set parameters on the graph instance.

// panel color
mySubstance.SetInputColor("paint_color", color);
// panel size
mySubstance.SetInputVector2("square_open", panelSize);
// wear level
mySubstance.SetInputFloat("wear_level", wearLevel);
// panel color mySubstance.SetInputColor("paint_color", color); // panel size mySubstance.SetInputVector2("square_open", panelSize); // wear level mySubstance.SetInputFloat("wear_level", wearLevel);
// panel color 
mySubstance.SetInputColor("paint_color", color); 
 
// panel size 
mySubstance.SetInputVector2("square_open", panelSize); 
 
// wear level 
mySubstance.SetInputFloat("wear_level", wearLevel);

The value in quotes is the parameter Identifier set in Substance Designer. 

In the Unity Inspector, you can mouse over a parameter to reveal a tooltip that showcases the name of the Identifier set in Substance Designer. 

3. Queue the Substance for Rendering: QueueForRender() will add the substance graph to a queue. This list will be processed by the next call to RenderAsync or RenderSync.

// queue the substance to render
mySubstance.QueueForRender();
//render all substances async
Substance.Game.Substance.RenderAsync();
// queue the substance to render mySubstance.QueueForRender(); //render all substances async Substance.Game.Substance.RenderAsync();
// queue the substance to render 
mySubstance.QueueForRender(); 
 
//render all substances async 
Substance.Game.Substance.RenderAsync();

Note:

Currently, we only support x86_64 Architecture. You need to set x86_64 in the Build Settings

Get help faster and easier

New user?