color change,change colour of game object

I am trying to change colour of cube from start function. I enter this c# script, attached it to cube, but the colour does not change. Can someone please explain why?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class playercolor : MonoBehaviour
{

    public GameObject cube;

    // Start is called before the first frame update
    void Start()
    {

        cube.GetComponent<Renderer>().material.color = Color.red;

    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

Hello there!

I think you need to take a look at some tutorials. Material is not the same as texture. Materials have textures, and you can change the color of the material depending on how you have it configurated, maybe you need to change the material.

I recomend you to watch at least this Unity tutorial:

Good luck!