I’m trying to give a material a random color every update. Here is my code:
using UnityEngine;
using System.Collections;
public class pTurretMaterial : MonoBehaviour {
public Renderer rend;
void Start () {
rend = GetComponent<Renderer>();
}
void Update () {
rend.material.color = Color(Random.Range(0, 1), Random.Range(0, 1), Random.Range(0, 1), 255);
}
}
But I keep getting this error message:
Assets/Scripts/pTurretMaterial.cs(16,31): error CS0119: Expression denotes a type', where a variable’, value' or method group’ was expected
What am I doing wrong?