How would I go about simulating a button click to produce the highlighting effect using a key press without actually clicking on the button
I have 9 of these buttons
OnGui
if(GUI.Button(new Rect(Screen.width / 2 - 225 , Screen.height - 56, 50, 50), "1"))
{
}
Update
if (Input.GetKey(KeyCode.Alpha1))
{
}
UPDATE
here is what I did and their might be a better way
public GUISkin pressed;
public GUISkin normal;
private GUISkin b1;
void Start()
{
pressed.button.normal.background = pressed.button.active.background;
b1 = normal;
}
void Update()
{
if (Input.GetKey(KeyCode.Alpha1))
{
b1 = pressed;
StartCoroutine(b1Timer());
}
}
IEnumerator b1Timer()
{
// Waits an amount of time
yield return new WaitForSeconds(.5f);
b1 = normal;
}