I am trying to get a button to blink in red and green (background color) but it blinks in red and white? The button image color is set to white in editor. I have changed colors in the editor but I do not get the blinking in the colors I need.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BlinkLock : MonoBehaviour
{
private Button btn_Lock;
private Color green = new Color(3, 65, 2, 255);
void Start()
{
btn_Lock = gameObject.GetComponentInChildren<Button>();
StartCoroutine(BlinkButton());
}
public IEnumerator BlinkButton()
{
while (true)
{
btn_Lock.image.color = Color.red;
yield return new WaitForSeconds(.5f);
btn_Lock.image.color = green;
yield return new WaitForSeconds(.5f);
}
}
}