public override void OnInspectorGUI() { base.OnInspectorGUI(); section = (Section)target; scriptSection = section.scriptSection; GUILayout.Space(20); DrawObstacleInterface(); }
private void DrawSectionUnit(ScriptableSection sectionToDraw, int index) { GUILayoutOption[] optionsIndex = new GUILayoutOption[2] { GUILayout.Height(50), GUILayout.Width(30) }; GUILayout.BeginHorizontal(); if (GUILayout.Button("" + index, optionsIndex)) { SceneView.lastActiveSceneView.LookAt(LevelManager.Instance.currentLevel.listSections[index].transform.position); Selection.activeGameObject = LevelManager.Instance.currentLevel.listSections[index].gameObject; } GUILayout.BeginVertical(); GUILayout.Label(sectionToDraw.name); sectionToDraw.prefabSection = (GameObject)EditorGUILayout.ObjectField("Prefab", sectionToDraw.prefabSection, typeof(GameObject), false); GUILayout.EndVertical(); if (GUILayout.Button("^", new GUILayoutOption[1] { GUILayout.Height(50) })) { if (index > 0) { currentLevel.MoveDownSection(index); LevelManager.Instance.UnfoldLevel(currentLevel); } } if (GUILayout.Button("ˇ", new GUILayoutOption[1] { GUILayout.Height(50) })) { if (index < currentLevel.listSections.Count) { currentLevel.MoveUpSection(index); LevelManager.Instance.UnfoldLevel(currentLevel); } } if (GUILayout.Button("Spprimer", optionsButton)) { currentLevel.RemoveSection(index); LevelManager.Instance.UnfoldLevel(currentLevel); } GUILayout.EndHorizontal(); }
private void SaveSection(ScriptableSection scriptSection) { AssetDatabase.Refresh(); EditorUtility.SetDirty(scriptSection); AssetDatabase.SaveAssets(); }