Aunnop Kattiyanet

Change Material's Rendering mode at runtime?

I make an rpg game and currently working on attacking system(really simple one). And I want to fade the enemy from opaque to completely transparent after it died. And I found how to change rendering mode at unity doc.

Regarding to this link

I do the same thing but it doesn't work at all even I make a copy of the same material and put the fade version to Resources folder. I just wonder why it doesn't work. Or I just have some problem with my interpretation...

Here's my code(short ver.)

private SkinnedMeshRenderer rend;


[chec if it's hp <= 0]

StartCoroutine (Fade());

IEnumerator Fade()


yield return new WaitForSeconds(1.5f);

rend.material.SetFloat("_Mode", 2);




[Fade color in Update() method]