Table of Contents

Using the Node Editor

Creating a color graph

To create a new color graph, select Gamelogic | New Color Graph from the menus. A wizard will appear that allows you to save the color graph in your project.

Once you have saved the file, click on it in the project view, and select Edit in the inspector. The Graph editor will open, from where you can add and edit nodes.

Working with nodes

To add a node, click one of the node buttons on the left of the window. Note that the first two buttons are not node buttons. A new node will appear, which you can drag to a convenient place on the window.

To remove a node, you can click on the Remove Node button on the node.

To remove all nodes from the graph, click the Clear button on the left of the window.

To add a link from one node to another, click on the first node’s Add link button. A link will appear, that you can connect to the second node by clicking on it. Not all nodes can be connected; the link will not form if it is illegal. Use the node reference to see which nodes are legal.

To remove a link, click on the red disk in the middle of the link.

Computing the output

To generate colors, you need to click the Recompute button on the left of the window. Colors will only be computed for nodes that have the right inputs. You graph should have at least one input node (Constant Color or Random Color). These nodes do not have inputs. All nodes can be used for inputs for other nodes. as long as they are of the right type.

Linking generated colors to your scene

Once you have created a graph with at least one input node, you can link it into your scene through scripting:

  1. Add an InspectableGraphNode public field to the script where you want to write the logic. This will allow you to link in the graphm and select the node from which you want to get the colors from. You can add multiple fields of InspectableGraphNode if you want to access more than one node from your script.

  2. In code, you can get the colors of the node if the InspectableGraphNode field using its Colors property. This is simply a list of colours. You can now write code to apply these colors to materials, sprites, UIImages, lights, or anywhere else you can adjust the color.

  3. In the Unity editor, drag the graph object in the appropriate field, and select the node you want to work from.

The examples that ship with colors show a simple way to follow these three steps to color different scenes.