How do you change the Sprite Mesh Value Anima2d?

I am using Anima2D to animate my characters. I need to programically lower the Mesh Color value.

Below is what I try but it doesn’t seem to work. I think its because it used the Sprite Mesh Instance Script.

I am trying this:

Renderer rend = thePlayer.GetComponentInChildren();

    //Set the main Color of the Material to green
    rend.material.shader = Shader.Find("_Color");
    rend.material.SetColor("_Color", Color.green);

    //Find the Specular shader and change its Color to red
    rend.material.shader = Shader.Find("Specular");
    rend.material.SetColor("_SpecColor", Color.red);

Thank You for the Help

You gotta used rend.sharedMaterial

If you call rend.material.shader. It will make a new copy of that material. You are just changing value of nothing.

Note: If you call sharedMaterial, every Object made from same prefab will be change color too.

If you want only to change 1 object material. You must create new material at runtime and apply it.

Thanks, I’ll try that @NoDumbQuestion