I want to make a script so that when an Object enters a trigger it’s material changes and shortly after it gets destroyed . I’v figured out how to destroy it OnTriggerEnter after WaitForSeconds(1) but I don’t know how I’d make the script change the objects material . What’s the code for this . For those who’d like more information it’s basically just a blue sphere I want to turn in to a white sphere OnTriggerEnter.
Try this:
public Texture texture;
void Example() {
renderer.material.mainTexture = texture;
}
Also see: Material