using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HeatScript : MonoBehaviour
{
public Material[] material;
Renderer rend;
void start ()
{
rend = GetComponent();
rend.enabled = true;
}
void OnCollisionEnter (Collision col)
{
if(col.gameObject.name == "Anvile")
{
StartCoroutine(ChangeColorToRed);
}
}
public IEnumerator ChangeColorToRed()
{
yield return new WaitForSeconds(4f);
rend.sharedMaterial = material[1];
}
}
There might be something very simple in here I am missing but I can't figure it out.
Since I'm new to the whole coding thing I figured posting for help is my best option.
↧