How do I get file size of texture?

I want to find out (at runtime) how big a Texture2D is. I’m looking to cache a certain number of em, but I want to have a cap on the amount of Textures cached for obvious reasons. How do I go about this?

Depends on what you mean by “size”. Do you mean file size? If so, use Profiler.GetRuntimeMemorySize(), which will return the amount of memory consumed by the asset. Note that this will work not only for textures, but for any asset in the game.