Hi, I’m just trying to change the color of a gameobject.
I’ve tossed this into the update section of the code: GetComponent().material.color = Color.black;
And am now getting this error: Assets/Scripts/gameobjectColor.cs(10,57): error CS0117: Color' does not contain a definition for
black’
I’ve tried a lot of things and I just can’t wrap my around why changing the color of a gameObject is so difficult, I am completely new to scripting / programming.
The code in its entirety is listed below.
using UnityEngine;
using System.Collections;
public class Color : MonoBehaviour
{
// Use this for initialization
void Start()
{
GetComponent<Renderer>().material.color = Color.black;
}
}