Quick answer: Unity OverlapBoxNonAlloc returning hits from a previous query? The buffer is reused but the count is the return value - iterate only count entries, not the whole array.

Buffer of 32 entries. Previous query returned 5 hits. Current query returns 2. Iteration reads all 5 from the previous call.

Use the return value

int count = Physics.OverlapBoxNonAlloc(...);
for (int i = 0; i < count; i++) ...

The function returns the actual count. The buffer past count is undefined.

Don't clear unnecessarily

Avoid Array.Clear between calls; the count discipline alone is sufficient. Clearing wastes time.

Size the buffer adequately

If count == buffer.Length, you may have truncated. Grow the buffer and re-query.

“NonAlloc APIs are pre-allocated. Pre-allocation requires post-call discipline.”

Wrap NonAlloc calls in helpers that return a slice (count + buffer). Iteration becomes self-bounded; the bug class disappears.