User Guide (Version 1.13)

Material Variables

When you use a node such as Find by Name, Load by Name, or Clone, the script can only use the material for that one frame. After the frame, the material is then invalid. If you want to reuse the material in your script, you can store the material in a #Variable Material node. You can also use this node when you want to find or load a material only once when the game starts.


The default value for the #Variable Material node is Invalid. To use this node, you must assign the variable to a valid material with a node such as Find by Name, Load by Name, or Clone.


            materialvariablenode, variablematerial, materialvariable


Pin Type Description
Display Name String Name of the material variable.
Default Value String Displays the default value of the variable, which is always Invalid for materials.


Pin Type Description
Get Material Sends the variable's current material.


The following script uses the #Variable Material node to make a material flash red.

  1. The result of the Find Sub-Material node is stored in a variable using a Set #MyMaterial node.

  2. Every 0.1 seconds, the Get #MyMaterial node uses the variable with the Set Param Color node to change the diffuse color of the material.

                Example Script Canvas editor script that uses the
                    variable material node.

On this page: