heyho when i press on my gameobject i want that his current material blend in one other material and back after you pressed again pls help i tried this but it wont work some ideas ?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class materialchanger : MonoBehaviour {
public Material material1;
public Material material2;
public float duration = 2.0F;
public Renderer rend;
void Start() {
rend = GetComponent<Renderer>();
rend.material = material1;
}
public void clickblendshphere() {
float lerp = Mathf.PingPong(Time.time, duration) / duration;
rend.material.Lerp(material1, material2, lerp);
}
}