public void toggleHighlighting() { if (highlightMats.Count != 0) { if (state == highlightState.NotHighlighted) { for (int i = 0; i < renderer.materials.Length; i++) { renderer.materials = highlightMats.ToArray(); } state = highlightState.Highlighted; } else { for (int i = 0; i < renderer.materials.Length; i++) { renderer.materials = originalMats.ToArray(); } state = highlightState.NotHighlighted; } } }
// Start is called before the first frame update void Start() { renderer = GetComponent <MeshRenderer>(); state = highlightState.NotHighlighted; }