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

[ExecuteInEditMode]
public class ChangeMaterialColor : MonoBehaviour {

    public Color MaterialColor;
	
	void Start () {
        MeshRenderer MR = GetComponent<MeshRenderer>();
        if (MR != null) {
            MR.sharedMaterial = new Material(MR.sharedMaterial);
            MR.sharedMaterial.color = MaterialColor;
        }
    }

    void OnValidate() {
        /*
        MeshRenderer MR = GetComponent<MeshRenderer>();
        if (MR != null) {
            MR.sharedMaterial = new Material(MR.sharedMaterial);
            MR.sharedMaterial.color = MaterialColor;
        }*/
    }
}
