Can you cast raycasts (specifficly 2D raycasts) in the update function or should you cast them in FixedUpdate like all other physics? Ive seen alot of tutorials casting rays in Update so I was wondering if this can be a problm or if it works fine.
You can cast whenever you like. Know that the physics system doesn’t actually move colliders per-frame, only per fixed-update so you’ll get the same results each time per-frame until the next fixed-update when, the collider may move.
This isn’t the case if you move the collider yourself which you shouldn’t do unless it is attached to a Kinematic body.
In short; yes, you can perform raycasts (and any other physics query) whenever you like.