Hi, I've knackered my brains... need a tuna sandwich, anyhew, see the code below, It simple fades the alpha of a quad on update for a set time then repeats, it's a pulse fade effect from zero to one, but what should I create to make it pulse the other direction from 1 to zero in the update, I like the pulse effect but a more subtle effect is needed Code (csharp): public GameObject Background; private Material Background_Mat; private float timer = 2.0f; void Start () { if (Background != null && Background.renderer != null) { Background_Mat = Background.renderer.material; } } void Update () { timer -= Time.deltaTime; Color QuadAlpha = Background_Mat.color; QuadAlpha.a = (1.0f / timer); if (timer < 0.1f) { QuadAlpha.a = 1.0f; timer = 2.0f; } Background_Mat.color = QuadAlpha; }
here's the simple script, just drag and drop a game object on there and your golden. Code (csharp): using UnityEngine; using System.Collections; public class BackgroundPulse : MonoBehaviour { public GameObject Background; private Material Background_Mat; void Start () { if (Background != null && Background.renderer != null) { Background_Mat = Background.renderer.material; } } void Update () { Color QuadAlpha = Background_Mat.color; QuadAlpha.a = Mathf.PingPong (Time.time, 1.0f); Background_Mat.color = QuadAlpha; } }