This is now available on the Unity Asset Store: https://assetstore.unity.com/packages/tools/audio/playlist-p-192284
This is an offshoot of a larger project. Originally to be a simple and minimal function for an audio player. I decided that I would like more functions than just the basics Play/Pause/Next functions. Ultimately, I will be hooking this up to Twitch’s API so that Twitch chat can have some control over the playlist.
Took a lot more time than I thought it would. Debugging and scouring message boards for specific help did not solve the encountered problems. However, I found an interesting article that helped a lot. Mostly, determining the accurate AudioClip.length, Time Elapsed and use of PlaySchedule. I won’t be talking about these issues, I suggest reading that article for a better understanding of why the standard member calls most people like to use are terrible.
All in all, this solved “seek position” being out of sync when it plays the next AudioClip, which would randomly either cause an “invalid seek position” error or completely just stop the AudioSource from playing. These issues also occurred when scrubbing randomly up and down on an AudioClip.
This was only going to use local files and list the playlist as a drop down. It worked nicely and I quite like it.
Having only listing local files felt too basic, so I had a genius idea of adding Google Drive functionality to it. This totally did not add more pointless production time to the overall larger project. My website uses the same Google Drive API anyway. It was not hard to port my web code over, since they were just web requests. A Google API Key is required to make api requests, this function will not work otherwise.
This was annoying. I don’t get why TextMeshPro does not have CJK support out of box. I think it’s dumb, and they should get on it. :}
I had to grab Noto Sans CJK off Google fonts and create a new Font.asset to include all of the ranges. Atlas Resolution set to 8k because for some reason anything less resulted in missing characters. Even at 8k, however, there are still some missing characters.
I’ll probably try to add more posts to my website as I continue building more tools in Unity3D. I doubt I will do anything in-depth, in terms of explanations for coding and or “guides/tutorials.” There are more than enough resources out there on the internet. Also, because I’m pretty sure I don’t know what I’m doing half the time. :D