Blinking GUI.Button and compassTip error help

This script is working fine. the problems is if GUI.color = red_blink; and red_blink.a = Mathf.Sin(Time.time * 8.0); is place on top of my compasstip script. it cause my compasstip to blink together with red color. and if i put the compasstip and GUIUtility.RotateAroundPivot… script on top of the other, all the things will be upside down, worse. so any one has any idea how to solve. please share with me THX

var red_blink : Color = GUI.color ;


if(timer > 100)

     GUI.color = red_blink;

     red_blink.a = Mathf.Sin(Time.time * 8.0);

     GUI.Button(Rect(845,610,150,30 ), "Going Explode" );
GUIUtility.RotateAroundPivot(helicopter.transform.localEulerAngles.y,Vector2( 577+64,660+64));


you need to save the color before the blinking, and restore it after. It will probably be white anyway. Same thing if you do a rotation, save the GUI.matrix and restore after.

Not related but, you should use Mathf.PingPong, instead of Sin. It’s not smooth, but you wont see any differences at that frequency, and the cost difference is huge. If only one object is executing that script it’s not a big deal but hey, now you know.