Hi!
Below is my code, however, I am getting an error suggesting GetComponent();
to fix the ** mat = renderer.material;**
Any Suggestions? I pulled the DIY from this source: Unity Touchscreen Input Tutorial - YouTube
using UnityEngine;
using System.Collections;
public class Button : MonoBehaviour {
public Color defaultColour;
public Color selectedColour;
private Material mat;
void Start() {
**mat = renderer.material;**
}
void OnTouchDown() {
mat.color = selectedColour;
}
void OnTouchUp()
{
mat.color = defaultColour;
}
void OnTouchStay()
{
mat.color = selectedColour;
}
void OnTouchExit()
{
mat.color = defaultColour;
}
}