void SelectionWindow(int id) { GUI.DragWindow(new Rect(0,0, 20000, 20)); GUILayout.BeginVertical(); // Cycle through the available objects to instantiate for(int i = 0; i < SHAPE_ENUM_LENGTH; i++) { if(i == (int)objectToInstantiate) GUI.color = Color.green; if(GUILayout.Button( ((ObjectSelectionOptions)i).ToString() )) objectToInstantiate = (ObjectSelectionOptions) i; GUI.color = Color.white; } GUI.color = Color.red; if(GUILayout.Button("Clear Screen")) { foreach(GameObject go in generatedObjects) GameObject.Destroy(go); generatedObjects.Clear(); } GUI.color = Color.white; GUILayout.Label("Click to instantiate the selected object."); GUILayout.EndVertical(); }
void SelectionWindow(int id) { GUI.DragWindow(new Rect(0, 0, 20000, 20)); GUILayout.BeginVertical(); // Cycle through the available objects to instantiate for (int i = 0; i < SHAPE_ENUM_LENGTH; i++) { if (i == (int)objectToInstantiate) { GUI.color = Color.green; } if (GUILayout.Button(((ObjectSelectionOptions)i).ToString())) { objectToInstantiate = (ObjectSelectionOptions)i; } GUI.color = Color.white; } GUI.color = Color.red; if (GUILayout.Button("Clear Screen")) { foreach (GameObject go in generatedObjects) { GameObject.Destroy(go); } generatedObjects.Clear(); } GUI.color = Color.white; GUILayout.Label("Click to instantiate the selected object."); GUILayout.EndVertical(); }
public void OnEnable() { foreach(Component c in probuilderPrefab.GetComponents<Component>()) { if(c is pb_Object) return; } objectToInstantiate = (ObjectSelectionOptions)1; }
public void OnEnable() { foreach (Component c in probuilderPrefab.GetComponents <Component>()) { if (c is pb_Object) { return; } } objectToInstantiate = (ObjectSelectionOptions)1; }