Example #1
0
        private void CreateNewLibraryFile(string path, List <Playlist> playlists = null)
        {
            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            try
            {
                MusicLibrary newMusicLibrary = ScriptableObject.CreateInstance <MusicLibrary>();

                newMusicLibrary.Playlists = playlists ?? new List <Playlist>()
                {
                    new Playlist("All Songs")
                };

                AssetDatabase.CreateAsset(newMusicLibrary, $"{path}");

                SetActiveLibrary(newMusicLibrary);

                ImportPlaylistsFromLibrary();

                SaveAsset(newMusicLibrary);
            }
            catch (Exception e)
            {
                Debug.LogError($"{LogPrefix} Could not create new Music Library! ({e})");

                return;
            }
        }
Example #2
0
        private void SetActiveLibrary(MusicLibrary library)
        {
            activeLibrary = library;

            proxyLibrary = activeLibrary;

            isActiveLibraryDefault = preferences != null && activeLibrary == preferences.DefaultLibrary;

            isActiveLibraryDemo = activeLibrary != null && activeLibrary.name == "DemoMusicLibrary";
        }