コード例 #1
0
    public void StartFade(Color screenColor, float speed, ArgumentVoid toRun)
    {
        fadeScreen.SetActive(true);
        screenColor.a = 0;

        StartCoroutine(FadeFrame(screenColor, speed, toRun));
    }
コード例 #2
0
    IEnumerator FadeFrame(Color screenColor, float speed, ArgumentVoid toRun)
    {
        yield return new WaitForEndOfFrame();
        Debug.Log(screenColor);
        fadeScreen.GetComponent<Image>().color = screenColor;

        if (screenColor.a >= 1f)
        {
            toRun();
        }
        else
        {
            screenColor.a += Time.deltaTime;
            StartCoroutine(FadeFrame(screenColor, speed, toRun));
        }
    }