Ejemplo n.º 1
0
    public IEnumerator FadeIn()
    {
        _colorMenu.gameObject.SetActive(true);
        _colorMenu.transform.GetChild(0).gameObject.SetActive(true);         // panel hidden by default
        CanvasGroup cg = _colorMenu.GetComponent <CanvasGroup>();

        cg.alpha = 0f;

        while (cg.alpha != 1f)
        {
            cg.alpha = Mathf.MoveTowards(cg.alpha, 1f, Time.deltaTime / 2f);
            yield return(new WaitForEndOfFrame());
        }
    }