// Update is called once per frame void Update() { if (In) { rawImage = Layer.GetComponent <RawImage>(); alpha.a = alpha.a >= 1 ? 0 : alpha.a + FadeTime; rawImage.color = new Color(255, 255, 255, alpha.a); if (alpha.a >= 1) { delete.Del(); this.enabled = false; } } else { rawImage = Layer.GetComponent <RawImage>(); alpha.a = alpha.a <= 0 ? 1 : alpha.a - FadeTime; rawImage.color = new Color(255, 255, 255, alpha.a); if (alpha.a < 0) { delete.Del(); this.enabled = false; } } }