unity, change shader for me and all my children
public void changeShaderForMeAndAllMyChildren(){
Transform[] childrenTransformList = GetComponentsInChildren<Transform>();//注意GetComponentsInChildren包括自身
foreach (Transform transform in childrenTransformList) {
transform.GameObject.GetComponent<MeshRenderer> ().material.shader = Shader.Find ("Custom/myShader”);
}
}