Global Variables

From Shader Forge Wiki
Jump to: navigation, search

Global variables can only be accessed in scripts. There are four types of global variables. These are Texture Asset, Color, Vector 4, and Value. Global values are created from their green, local node counterparts. When a node is made global, it can no longer be modified in the SF editor. In addition, changes made in the code on the Global variable are not updated in the SF editor. Only the Normal map toggle of the Texture Asset global node can be changed in the editor. When a node is made global, the previous value contained in the node is changed into a default value. The color changes to grey, the value changes to 1, the vector 4 changes to grey (0.5, 0.5, 0.5, 1). If a Texture Asset has a value, this value is maintained in the global version. After a node is made global, the node name is prefixed with an underscore. The name can be changed afterwards, however. Both the Vector 4 and value nodes have three versions: constant, local/green(inspector changeable), and global
Local-Global-const nodes.png
To make a node into a global variable, right click on the node and select 'Make Global'.
SF MakeGlobal.gif