void OnGUI() { mGrid = Object.FindObjectOfType<Grid>(); if(mGrid != null) { mGrid.DisplayGrid = true; int size = Mathf.Max(0, EditorGUILayout.IntField("Size", mGridSize)); //dont allow odd numbers mGridSize = size % 2 == 0 ? size : size < mGridSize ? size - 1 : size + 1; if (GUILayout.Button("Generate Grid")) { GenerateGrid(); } if(selectedNodes != null && selectedNodes.Count > 0) { foreach (GameObject go in selectedNodes) { GridNode gn = mGrid.ObjectToGridNode(go); if (gn != null) RenderSelectedNodeOptions(gn); } } } else { Debug.Log("Please create a Grid Object and attach the Grid Component"); } }