色のアルファ値 (透明度) を前後に変更したい:
private void Awake()
{
material = gameObject.GetComponent<Renderer>().material;
oColor = material.color; // the alpha here is 0
nColor = material.color;
nColor.a = 255f;
}
private void Update()
{
material.color = Color.Lerp(oColor, nColor, Mathf.PingPong(Time.time, 1));
}
これは機能せず、色が即座に白に変わり、元の色が点滅し続けます。私はこれに従っています。