I have an editor script that looks at the objects materials and extracts from them texture information. I'd like for the script to be able to get information on all 2D textures. Presently I've only been able to use sharedMaterial.GetTexture("_MainTex"), where I have to call each texture channel by name directly. Some shaders though specify custom channel names. Is there a way to do this without having to manually add each channel name to the script?
I'm thinking something like this:
var texs : Texture2D[] = obj.renderer.sharedMaterial.GetTextures();
Thanks for any input.
Walker
UPDATE: What I'm doing is listing all of the textures from a selected set of objects. My goal is to retrieve all unique textures, whether they are _MainTex, _Bump, etc. With this list I'm displaying a reference to each texture with a concise report of the dimensions, mip level and import settings. I was hoping I could make this tool work generally for all future shaders that may have custom 2D properties.