问题如上,目的是希望实现白色的图片从不透明到完全透明的变化,给image挂载的代码如下:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class WhiteMask : MonoBehaviour {
private Image imageColor;
public float speed = 10;
private void Awake()
{
imageColor =this. GetComponent<Image >();
}
// Update is called once per frame
void Update () {
imageColor .color =new Color (255f,255f,255f,Mathf.MoveTowards (1f, 0, speed*Time.deltaTime));
}
}
问题是,完全实现不了,求问老师代码哪里写错了