Skip to content

Instantly share code, notes, and snippets.

@EsProgram
Last active Aug 29, 2015
Embed
What would you like to do?
Unity:親を含めた子オブジェクトの全てのマテリアルの取得
private List<Material> materials = new List<Material>();
foreach(Transform child in transform)
{
if(child != null && child.renderer != null && child.renderer.material != null)
foreach(Material mat in child.renderer.materials)
materials.Add(mat);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment