Skip to content

Instantly share code, notes, and snippets.

@naruse
Created November 10, 2014 19:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save naruse/5d6ff992cde260cdb6ac to your computer and use it in GitHub Desktop.
public List<Texture> GetTextures2D(Material mat) {
List<Texture> list = new List<Texture>();
int count = ShaderUtil.GetPropertyCount(mat.shader);
for(var i = 0; i < count; i++) {
if(ShaderUtil.GetPropertyType(mat.shader, i) == ShaderUtil.ShaderPropertyType.TexEnv) {
string propertyName = ShaderUtil.GetPropertyName(mat.shader, i);
if(propertyName != "_Cube") {
list.Add(mat.GetTexture(propertyName));
}
}
}
Debug.Log("Textures:" + list.Count + " total properties: " + count);
return list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment