Continuous Raycast on GetButton...

I have a basic Raycast script witch activates on Input.GetButton. Of course, the raycast is only active when the button is pressed, but not afterwards.

Is there a piece of script i can add to make the Raycast ‘persistant’ after the button is pressed, and not go off when the button is released? I’d like to try and do it without Booleans in this particular case.

 if(Input.GetButton("gravitydown")){
    var down = transform.TransformDirection(-transform.up);

Debug.DrawRay(transform.position, -transform.up, Color.green);
if(Physics.Raycast(transform.position, -transform.up, myLine)){

    sum.Stuff(happens(here));

}

}

Thank you for your time, Tom :slight_smile:

you can use Coroutine with loop and execute it on GetButtonDown. so Coroutine will starts on mouse button down and stops whenever you want - just write conditions in loop