void SpawnHazardOrSwitch() { if (Selection.activeGameObject.GetComponent <WallSelector>() != null) { EditorGUILayout.LabelField("Hazard/Switch spot"); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Spawn Hazard here")) { RM.NewHazard(Selection.activeTransform.GetChild(0).position + new Vector3(0, 2, 0) + Selection.activeTransform.right * 0.5f, Selection.activeTransform.rotation); } if (GUILayout.Button("Spawn Switch here")) { RM.NewSwitch(Selection.activeTransform.GetChild(0).position + new Vector3(0, 2, 0) + Selection.activeTransform.right * 0.5f, Selection.activeTransform.rotation); } EditorGUILayout.EndHorizontal(); } if (Selection.activeGameObject.GetComponent <InnerCornorSelector>() != null) { EditorGUILayout.LabelField("Hazard/Switch spot"); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Spawn Hazard Left")) { RM.NewHazard(Selection.activeTransform.GetChild(1).position + Selection.activeTransform.GetChild(1).right * 0.5f, Selection.activeTransform.GetChild(1).rotation); } if (GUILayout.Button("Spawn Hazard Right")) { RM.NewHazard(Selection.activeTransform.GetChild(2).position + Selection.activeTransform.GetChild(2).right * 0.5f, Selection.activeTransform.GetChild(2).rotation); } if (GUILayout.Button("Spawn Switch Left")) { RM.NewSwitch(Selection.activeTransform.GetChild(1).position + Selection.activeTransform.GetChild(1).right * 0.5f, Selection.activeTransform.GetChild(1).rotation); } if (GUILayout.Button("Spawn Switch Right")) { RM.NewSwitch(Selection.activeTransform.GetChild(2).position + Selection.activeTransform.GetChild(2).right * 0.5f, Selection.activeTransform.GetChild(2).rotation); } EditorGUILayout.EndHorizontal(); } if (Selection.activeGameObject.GetComponent <OuterCornorSelector>() != null) { EditorGUILayout.LabelField("Hazard/Switch spot"); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Spawn Hazard Left")) { RM.NewHazard(Selection.activeTransform.GetChild(1).position + Selection.activeTransform.GetChild(1).right * 0.5f, Selection.activeTransform.GetChild(1).rotation); } if (GUILayout.Button("Spawn Hazard Right")) { RM.NewHazard(Selection.activeTransform.GetChild(2).position + Selection.activeTransform.GetChild(2).right * 0.5f, Selection.activeTransform.GetChild(2).rotation); } if (GUILayout.Button("Spawn Switch Left")) { RM.NewSwitch(Selection.activeTransform.GetChild(1).position + Selection.activeTransform.GetChild(1).right * 0.5f, Selection.activeTransform.GetChild(1).rotation); } if (GUILayout.Button("Spawn Switch Right")) { RM.NewSwitch(Selection.activeTransform.GetChild(2).position + Selection.activeTransform.GetChild(2).right * 0.5f, Selection.activeTransform.GetChild(2).rotation); } EditorGUILayout.EndHorizontal(); } }