(Unity)Panelの色を徐々に薄くする(透明にする)

(スクリプト)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// ★追加
using UnityEngine.UI;

public class PanelController : MonoBehaviour
{
    private Image panelImage;

    void Start()
    {
        panelImage = GetComponent<Image>();
    }

    void Update()
    {
        panelImage.color = Color.Lerp(panelImage.color, new Color(0, 0, 0, 0), 0.5f * Time.deltaTime);
    }
}

(実行結果)