I have a very similar question to the one that was asked over here:
My issue with the answer that was provided is it makes the assumption that my “Rock” layer will be in a fixed layer of the alphamap. This isn’t my case. I may have levels with 0, 1, or many “Rock” layers. I don’t want to have to constantly keep track of which textures are being used on each level. I’d like to write a simple editor script that keeps track of this for me.
Every time I save the file, I want my script to just get each of my terrains, check the textures used, and store in an array which alphamap layers are “Rock” or not based on the name of the texture.
So my question is - how do I programmatically get the names of the textures used on a given piece of terrain? This is happening in an Editor Script, if that helps. I figure it must be possible, because the Unity Editor keeps track of this (or am I mistaken in thinking that all the pieces of the Unity Editor were built using these same classes that we have access to?)