private void ApplyPlaylistsToPlayer() { if (PrefabUtility.GetNearestPrefabInstanceRoot(player) != null) { if (!EditorUtility.DisplayDialog("Unpack prefab for playlist update?", "The player prefab has to be unpacked before changing the playlist data.\n\nContinue?", "OK", "Cancel")) { return; } PrefabUtility.UnpackPrefabInstance(PrefabUtility.GetNearestPrefabInstanceRoot(player), PrefabUnpackMode.Completely, InteractionMode.UserAction); } List <VRCUrl> urls = new List <VRCUrl>(); List <string> titles = new List <string>(); List <string> artists = new List <string>(); List <int> playlistIndices = new List <int>(); List <string> playlistNames = new List <string>(); int currentSongIndex = 0; foreach (Playlist playlist in activeLibrary.Playlists) { playlistNames.Add(playlist.Name); playlistIndices.Add(currentSongIndex); currentSongIndex += playlist.Songs.Count; foreach (Song song in playlist.Songs) { urls.Add(new VRCUrl(song.URL)); titles.Add(song.Name); artists.Add(song.Artist); } } Undo.RecordObject(player.GetComponent <UdonBehaviour>(), "Apply music library to player"); player.Urls = urls.ToArray(); player.Titles = titles.ToArray(); player.Artists = artists.ToArray(); player.PlaylistIndices = playlistIndices.ToArray(); player.PlaylistNames = playlistNames.ToArray(); player.ApplyProxyModifications(); RefreshPlayerStats(); }