0
votes

I'm very new on shader programming and would be interested in modify urp lit shader to support setting properties in objects with MaterialPropertyBlock on runtime.

The objective is to have several objects with the same material 'tinted' with a different color each one.

Thanks!

1

1 Answers

-1
votes

I don't know shader programming but if you want several objects sharing a material to be tinted with different colors a script like this might work :

public class Tint : MonoBehaviour
{
    public Color TintColor;

    [Range(0,1)]
    public float TintIntensity = 0.5f;
        
    private void OnEnable()
    {
        Material material = GetComponent<MeshRenderer>().material;
        material.color = Color.Lerp(material.color,TintColor,TintIntensity);
    }

}