I've started doing a pattern to pass "parameter structs" instead of method optional params. Also using type? for the optional aspect. So I have:
void Hit(HitInfo info) and:
struct HitInfo {
public float hp;
Vector3 point;
Vector3? direction;
}
I figured using a Vector3? is more flexible than checking direction == Vector3.zero, and more readable, but I read that all the HasValue / Value accessing causes boxing and extra allocations, is worrying about this premature optimization?
Or would explicit bool hasDirection; in my struct be all around better?