Last active
August 29, 2015 14:05
-
-
Save EsProgram/748d25543592c21aaa51 to your computer and use it in GitHub Desktop.
Unity:親を含めた子オブジェクトの全てのマテリアルの取得
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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