I have animated my bird in blender and have imported that to Unity. I want to change the color of the bird via script so that I can change it from the settings panel.
What I noticed is that there is a .png file which is attached to the Base Map of the surface Input component under material component for the bird mesh.(Have attached the screenshot below).If I change the .png pic manually the bird color changes with the according variation in color I want. I want to change this via script so I wrote a small script as follows:
public class BirdMeshColor : MonoBehaviour
{
    // Start is called before the first frame update
    
    void Start()
    {    
        MeshRenderer meshRenderer = GetComponent<MeshRenderer>();    
        meshRenderer.material.SetTexture("_BaseMap", Resources.Load<Texture2D>("BirdColorsPics/greenBird.png"));
    }
}
But I get an error saying
"There is no 'MeshRenderer' attached to the "BirdMesh" game object, but a script is trying to access it. You probably need to add a MeshRenderer to the game object "BirdMesh"
I tried to run it in the script attached to the main bird as well and still got the same output I don't know what wrong I am doing.
I don't know what wrong I am doing.

 
    