I have found that there are no proper tutorial for material color changing in unity by scripting.
Here I have tried a small code to change the color of material by string value. Other old posts are using Color.White method, this code will support string value for color changing ( #FFFFFFFF ).
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MatTest : MonoBehaviour {
public Transform go1;
MaterialPropertyBlock _propblock;
Renderer _renderer;
String colorCode = β#3E0808FFβ;
void Start () {
_renderer = go1.GetComponent ();
_propblock = new MaterialPropertyBlock ();
_renderer.GetPropertyBlock (_propblock);
Color myColor = new Color();
ColorUtility.TryParseHtmlString(colorCode, out myColor);
_propblock.SetColor(β_Colorβ, myColor);
_renderer.SetPropertyBlock (_propblock);
}
}