void Start () {
const string MainTexVariableName = "_MainTex";
var renders = gameObject.GetComponentsInChildren<Renderer>(); var resMat = Resources.Load<Material>("CharacterThrough"); foreach (var render in renders)
{
var oreginalMaterial = render.sharedMaterial;
var currentRender = render; var newMat = new Material(resMat); newMat.SetTexture(MainTexVariableName, oreginalMaterial.GetTexture(MainTexVariableName)); currentRender.material = newMat; }
}