static public bool ShouldCreate(GameObject go, bool isValid) { GUI.color = isValid ? Color.green : Color.grey; GUILayout.BeginHorizontal(); bool retVal = GUILayout.Button("Add To", GUILayout.Width(76f)); GUI.color = Color.white; GameObject sel = EditorGUILayout.ObjectField(go, typeof(GameObject), true, GUILayout.Width(140f)) as GameObject; GUILayout.Label("Select the parent in the Hierarchy View", GUILayout.MinWidth(10000f)); GUILayout.EndHorizontal(); if (sel != go) { Selection.activeGameObject = sel; } if (go == null || go.GetComponent <NGraph>()) { return(false); } if (retVal && isValid) { NGraphUtils.RegisterUndo("Add Graph"); return(true); } return(false); }