How do i make an object (in my case, a muzzle flare) that blinks on an off and so on when a button is pressed?
var flareRotate = 0;
function Update() {
transform.Rotate(0,flareRotate * Time.deltaTime,0);
GetComponent(MeshRenderer).enabled = false;
if (Input.GetButton(“G”)) {
GetComponent(MeshRenderer).enabled = true;
}
}
this is what i have so far.
- ignore the flareRotate and the transforms. those are for something unrelated.
- The GetConent and mesh renderer and stuff make it visible and invisible
what i want is for it to blink every .1 seconds. like a machine gun!