- Substance 3D home
- Ecosystems and Plugins
- Home
- Game Engines
- Unreal Engine
- Unreal Engine 5
- Unreal Engine 5 overview
- Unreal Engine 5 Release Notes
- Plugin Overview - UE5
- Plugin Settings - UE5
- Substance Input Image - UE5
- Material Instance Definition - UE5
- Material Template Usage - UE5
- Out-of-the-Box Material Templates
- Tiling Substance - UE5
- Substance 3D Plugin Default Templates
- Substance 3D Assets Library Usage - UE5
- Blueprints - UE5
- Unreal Engine 5 Scripting
- Installing to Source Builds
- Unreal Engine 5 overview
- Unreal Engine 4
- Unreal Engine 4 overview
- Unreal Engine 4 plugin release notes
- Unreal plugin 4.27.0.1
- Unreal plugin 4.26.0.21
- Unreal plugin 4.26.0.2
- Unreal plugin 4.26.0.1
- Unreal plugin 4.25.0.5
- Unreal plugin 4.25.0.4
- Unreal plugin 4.25.0.3
- Unreal plugin 4.24.0.3
- Unreal plugin 4.23.0.2
- Unreal plugin 4.23.0.1
- Unreal plugin 4.22.0.33
- Unreal plugin 4.22.0.32
- Unreal plugin 4.21.0.31
- Plugin Overview - UE4
- Plugin Settings - UE4
- Substance Input Image - UE4
- Material Instance Definition - UE4
- Tiling Substance - UE4
- Working with Bump Offset (Parallax) - UE4
- Working with Displacement - UE4
- Source in UE4
- Live Link in UE4
- Blueprints - UE4
- Unreal Engine 4 Scripting
- Unreal Engine 4 overview
- Unreal Engine 5
- Unity
- Unity overview
- Unity Release Notes
- Downloading Substance 3D Plugin in Unity
- Unity Plugin Overview
- Unity Preferences
- Optimization Guidelines
- Upgrading Projects/Known Issues
- Managing Substance Graphs
- Changing parameters
- Generated Textures (Packing)
- Rendering Color Space
- Using Image Inputs
- Publishing for Mobile
- Substance 3D for Unity Scripting
- Scripting in Unity (Deprecated)
- API Overview
- Scripting API
- C# Example Script
- Substance 3D Assets Library Usage
- Removing Substance Plugin
- Substance 3D in Unity Tutorials
- Physical Size in Unity
- Sharing sbsar Files Between Projects
- Unity overview
- Lumberyard
- Roblox
- Unreal Engine
- 3D Applications
- Maya
- 3ds Max
- MODO
- MODO overview
- Modo Plugin Release Notes
- Substance in MODO Overview
- Modo Installation
- Parameters
- Custom Materials
- Working with Normals
- Working with Emissive
- Bump and Displacement
- Working with References
- Animating Substances
- Copy/Duplicate Substance
- Environment and Rendering Setup
- Modo Switch Engine
- Tiling Modo textures
- MODO overview
- Cinema 4D
- Houdini
- Blender
- Blender overview
- Release Notes
- Substance in Blender Overview
- Downloading and Installing the Plugin
- Preferences
- The Substance 3D Panel
- Shortcuts and Navigation
- Workflows
- Physical size in Blender
- Substance 3D Assets Library
- Troubleshooting
- Uninstalling the Add-on
- Substance 3D Add-on for Blender Tutorials
- Blender overview
- Creative Cloud Applications
- Renderers
- Partnerships
Scripting API
Substance in Unity API - 2.2.0
Substance material parameters
Public Method | Description | Parameter |
---|---|---|
public float GetInputFloat(string inputName) | Get Substance Float Input | String inputName Name of the input in the SBSAR |
public int SetInputFloat(string inputName, float value) | Update Substance Float Input | String inputName Name of the input in the SBSAR Float value Value used to update parameter |
public void SetInputVector2(string inputName, Vector2 value) | Update Substance Vector2 Input | String inputName Name of the input in the SBSAR Vector2 input Values used to update parameter |
public vector2 GetInputVector2(string inputName) | Get Substance Vector2 Input | String "inputName" Name of the input in the SBSAR |
public void SetInputVector3(string inputName, Vector3 value) | Update Substance Vector3 Input | String inputName Name of the input in the SBSAR Vector3 value Values used to update parameter |
public vector3 GetInputVector3(string inputName) | Get Substance Vector3 Input | String inputName Name of the input in the SBSAR |
public void SetInputVector4(string inputName, Vector4 value) | Update Substance Vector4 Input | String inputName Name of the input in the SBSAR Vector4 value Values used to update parameter |
public vector4 GetInputVector4(string inputName) | Get Substance Vector4 Input | String inputName Name of the input in the SBSAR |
public void SetInputColor(string inputName, Color value) | Update Substance Color Input | String inputName Name of the input in the SBSAR Color Value used to update the parameter |
public color GetInputColor(string inputName, int dataType) | Get Substance Color | String inputName Name of the input in the SBSAR Int dataType |
public void SetInputBool(string inputName, bool value) | Update Substance Boolean Input | String inputName Name of the input in the SBSAR Bool value Value used to update the parameter |
public bool GetInputBool(string inputName) | Get Substance Boolean Input | String inputName Name of the input in the SBSAR |
public void SetInputInt(string inputName, int value) | Update Substance Int Input | String inputName Name of the input in the SBSAR |
public int GetInputInt(string inputName) | Get Substance Int Input | String inputName Name of the input in the SBSAR |
public void SetInputVector2Int(string inputName, int x, int y) | Update Substance Vector2Int Input | String inputName Name of the input in the SBSAR Int x Value used to update the parameter Int y Value used to update the parameter |
int[] Substance.Game.SubstanceGraph.GetInputVector2Int( string inputName) | Get array of 2 int (Vector2Int’s x & y values) | String inputName Name of the input in the SBSAR Int x Value used to update the parameter Int y Value used to update the parameter |
void Substance.Game.SubstanceGraph.SetInputVector3Int( string inputName, int x, int y, int z) | Update Substance Vector3Int Input | String inputName Name of the input in the SBSAR Int x Value used to update the parameter Int y Value used to update the parameter Int z Value used to update the parameter |
int[] Substance.Game.SubstanceGraph.GetInputVector3Int( string inputName) | Get array of 3 int (Vector3Int’s x, y & z values) | String inputName Name of the input in the SBSAR Int x Value used to update the parameter Int y Value used to update the parameter Int z Value used to update the parameter |
void Substance.Game.SubstanceGraph.SetInputVector4Int( string inputName, int x, int y, int z, int w) | Update Substance Vector4Int Input | String inputName Name of the input in the SBSAR Int x Value used to update the parameter Int y Value used to update the parameter Int z Value used to update the parameter Int w Value used to update the parameter |
int[] Substance.Game.SubstanceGraph.GetInputVector4Int( string inputName) | Get array of 4 int (Vector4Int’s x, y, z & w values) | String inputName Name of the input in the SBSAR Int x Value used to update the parameter Int y Value used to update the parameter Int z Value used to update the parameter Int w Value used to update the parameter |
void Substance.Game.SubstanceGraph.SetInputString( string inputName, string value) | Update Substance string Input | String inputName Name of the input in the SBSAR String value used to update the parameter |
string Substance.Game.SubstanceGraph.GetInputString( string inputName) | Get Substance string input | String inputName Name of the input in the SBSAR |
void Substance.Game.SubstanceGraph.SetInputTexture( string inputName, Texture2D value) | Update Substance Texture2D Input | String inputName Name of the input in the SBSAR Texture2D value used to update the parameter |
Texture2D Substance.Game.SubstanceGraph.GetInputTexture( string inputName) | Get Substance Texture2D Input | String inputName Name of the input in the SBSAR |
VectorInt Substance.Game.SubstanceGraph.GetTexturesResolution() | Get the graph’s Target Settings textures resolution (Vector4Int’s x = width, y = height, values can be 32, 64, 128, 256, 512, 1024, 2048 & 4096) | None |
int Substance.Game.SubstanceGraph.SetTexturesResolution( Vector2Int size) | Set the graph’s Target Settings textures resolution (Vector2Int’s x = width, y = height, values can be 32, 64, 128, 256, 512, 1024, 2048 & 4096) Returns 0 if success, otherwise: -1. | Vector2Int size used to update the parameter. |
List Substance.Game.SubstanceGraph.GetGeneratedTextures() | Returns all Substance Texture2D objects used by the graph’s material shader. | None |
int Substance.Game.SubstanceGraph.Bake( Texture2D texture, string absolutePath) | Generate .png files for all Substance Texture2D objects used by the graph’s material shader. | None |
Substance.Game.SubstanceGraph.Duplicate() | Duplicate a Substance Graph | None |
Substance.Game.SubstanceGraph.Duplicate(string newGraphName) | Duplicate a Substance Graph and give it a name (the corresponding material will also have the same name) | String newGraphName |
Substance.Game.SubstanceGraph.GetInputProperties() | Query procedural input information, returns an array of 'InputProperties', with: public struct InputProperties public string[] componentLabels; // for sliders (up to 4 labels) public InputPropertiesType type; public Vector4 maximum; // for sliders public enum InputPropertiesType | None |
bool Substance.Game.SubstanceGraph.HasInput(string inputName) | Check if an input exists in a graph, returns true/false: | String inputName Name of the input in the SBSAR |
bool Substance.Game.SubstanceGraph.IsInputVisible(string inputName) | Check if a visibleif input is visible, returns true/false | String inputName Name of the input in the SBSAR |
Rendering
Public Method | Description | Parameter |
---|---|---|
public void QueueForRender() | Add Substance graph to queue | None |
mySubstance.RenderAsync() | Render all queued Substance graphs asynchronously | None |
mySubstance.RenderSync() | Render all queued Substance graphs synchronously | None |
Scripting in Editor mode:
In order to make graph modifications permanent in Editor mode, a re-import of each corresponding Substance must be performed. This is done with the following function:
static void ReImportSubstance(Substance.Game.Substance pSubstance)
{
// Re-import Substance object:
SubstanceImporter importer =
AssetImporter.GetAtPath(pSubstance.assetPath) as SubstanceImporter;
importer.CommitSubstanceToImporter(pSubstance); // plugin function
EditorUtility.SetDirty(importer);
importer.SaveAndReimport();
}
(with ‘CommitSubstanceToImporter’, a Substance plugin function: copy all modified graph parameters and/or inputs to the Substance importer object, which is then serialized to disk via Unity’s importer mechanism)