private void SaveFable() { using (new EditorGUI.DisabledScope(_fableNeedUpdate || _fableTitle == "" || _fableText == "" || audioClip == null)) { if (GUILayout.Button(new GUIContent("Save Fable"), GUILayout.Width(98), GUILayout.Height(30))) { FableAsset fable = new FableAsset(_fableTitle, _fableText, audioClip); List <FableAsset.NarrationMarker> narMarkers = new List <FableAsset.NarrationMarker>(); foreach (TimestampMarker marker in _markers) { narMarkers.Add(new FableAsset.NarrationMarker(marker.audioTime, marker.sample)); } fable.markers = narMarkers; if (FableAssetCreator.CreateAsset(fable)) { Debug.Log("Asset creation succeeded"); } else { Debug.Log("Asset creation failed"); } } } }
private void LoadFable() { if (GUILayout.Button(new GUIContent("Load Fable"), GUILayout.Width(98), GUILayout.Height(30))) { string fablePath = EditorUtility.OpenFilePanel("Load Fable", "Assets/Prefabs/Narration", ""); if (fablePath != "") { fablePath = fablePath.Replace(Application.dataPath, "Assets"); FableAsset loadedFable = FableAssetCreator.LoadAsset(fablePath); if (loadedFable != null) { _fableTitle = loadedFable.fableTitle; _fableText = loadedFable.fableText; audioClip = loadedFable.audioClip; _markers = new List <TimestampMarker>(); if (loadedFable.markers != null) { foreach (FableAsset.NarrationMarker marker in loadedFable.markers) { _markers.Add(new TimestampMarker(marker.audioTime, marker.sample)); } } else { Debug.Log("Loaded markers are empty."); } ResetSettings(); PaintWaveform(); Repaint(); } else { Debug.Log("Wadu hek :("); } } } }