Description
The GridSize
property of the GraphView
class in the Editor.NodeEditor
namespace represents the size of the grid used in the node editor's graphical interface. This property is a float
value that determines the spacing between grid lines, which can be useful for aligning nodes and other elements within the editor.
Usage
To adjust the grid size in a node editor, you can set the GridSize
property to a desired float value. This will change the spacing of the grid lines, allowing for finer or coarser alignment of nodes.
For example, if you want a finer grid, you might set GridSize
to a smaller value. Conversely, for a coarser grid, set it to a larger value.
Example
// Example of setting the GridSize property
GraphView graphView = new GraphView();
graphView.GridSize = 10.0f; // Sets the grid size to 10 units
// Accessing the current grid size
float currentGridSize = graphView.GridSize;
// Output: 10.0f