Normally of course, setting a raycast from a function in Update casts a ray every frame. I’m trying to use a Coroutine to have the raycasts happen every 0.2 seconds instead of every frame but I’m struggling big time.
To be clear:
-
The function that casts the ray is called from Update, meaning the function is accessed every frame.
-
By default, the ray is cast every frame but I need it to be cast every fraction (0.2f) of a second instead.
-
I need the Debug.DrawRay command included for testing.
-
I need rays to keep being cast (but with a delay between each). Not fire once or twice and that’s it.
-
THE LANGUAGE HAS TO BE C#. Not JS