Skip to content

Instantly share code, notes, and snippets.

@EsProgram
Last active August 29, 2015 14:05
Show Gist options
  • Save EsProgram/748d25543592c21aaa51 to your computer and use it in GitHub Desktop.
Save EsProgram/748d25543592c21aaa51 to your computer and use it in GitHub Desktop.
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