Skip to content

Unity Substance plugin that gives you the ability to easily model Substance parameters and manipulate their values at runtime.

License

Notifications You must be signed in to change notification settings

jbw/substance-abuse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

substance-abuse

Ability to simply configure a model parameters from a Substance texture and manipulate their values at runtime. Defaults can also be set in the Inspector.

Create config

InputParameter value should map to the exposed Substance parameter name. If you can't find it, hover over the parameter of your Procedural Material component in Unity's Inspector window.

public class GrassSubstanceParameters : SubstanceParameters
{
    [InputParameter("Grass_Amount")]
    public float GrassAmount;

    [InputParameter("GrassLength")]
    public float GrassLength;
}

Connect

Connect the parameter class to the configuration.

Connect

Manipulate

Use your components and maniplate their parameters.

using UnityEngine;
using System.Collections;

public class RuntimeManipulationExample : MonoBehaviour {

	// Use this for initialization
	void Start () {

        var aCube = GameObject.FindGameObjectWithTag("Cube1");

        var grassParams = aCube.GetComponent<GrassSubstanceParameters>();
        grassParams.GrassAmount = 10;

        var config = aCube.GetComponent<SubstanceConfiguration>();
        config.parameters = grassParams;
        
        // Rebuild the texture
        config.Config();
    }

    // Update is called once per frame
    void Update () {
	
	}
}

See example of how to change Substance property values for a configuration.

Manipulate

Known Compatibility

  • Substance >=3.5
  • Unity >= 5

http://docs.unity3d.com/ScriptReference/ProceduralMaterial.html

About

Unity Substance plugin that gives you the ability to easily model Substance parameters and manipulate their values at runtime.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages