Thanks for the fast response @ferdinand . Sorry that the title of my question is somewhat misleading. The thread that you've linked is actually quite detailed and useful I'll take a closer look into that.
Thanks @ferdinand. I guess I'll have to skip on that idea 🙂 I was really hoping that there is something like .GetAllTextures or .GetAllAssets, but it seems I'm out of luck on this one.
Nevermind. I figured it out 🙂 It was my mistake in the code. I made myself a helper function to initialize the ViewportSelect object, and I was initializing it with the wrong object. That's where the runtime error came from. Thanks anyway.