using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ButtonBlink : MonoBehaviour {

    [SerializeField] private float length;
    private Material reference;

    private void Start() {
        reference = GetComponent<Image>().material;
        color = reference.GetColor("_OutlineColor");
        start = color;

    }

    private Color color;
    private Color start;
    private void Update() {

        color.r = start.r* Mathf.PingPong(Time.time, length);
        color.g = start.g *Mathf.PingPong(Time.time, length);
        color.b = start.b*Mathf.PingPong(Time.time, length);
        //reference.SetVector("_EmissionColor", Color.white * Mathf.PingPong(Time.time, length));
        reference.SetColor("_OutlineColor", color);

    }

}
