RaycastAll vs Collider.Raycast gives different results

RaycastAll is supposed to return all objects on the path of the ray for specified distance, right?

RaycastHit[] hits = Physics.RaycastAll(ray, float.PositiveInfinity);

// DEBUG
string debug = "Raycast all gave " + hits.Length + " hits:";
for (int i = 0; i < hits.Length; i++)
    debug += hits*.collider.gameObject.name + "; ";
Debug.Log(debug);
var colliders = GameObject.FindObjectsOfType<Collider>();
foreach (var collider in colliders)
{
    if (collider.Raycast(ray, out RaycastHit temp, float.PositiveInfinity))
    {
        Debug.Log("Manually verified, that ray hits " + collider.gameObject.name);
    }
}
// END DEBUG

On some occasions, I’m getting:
Raycast all gave 1 hits: "MissileExplosion(Clone)"
Manually verified, that ray hits "MissileExplosion(Clone)"
Manually verified, that ray hits "Falcon(Clone)"

Shouldn’t RaycastAll return the same set of results?
What may cause that?
Is it a bug in Unity?


I filed a bug report and Unity QAs managed to reproduce it. It have been sent do Unity devs and hopefully will be fixed in upcoming release of the editor.

Apparently, the bug still hasn’t been fixed because I’m getting the same error…

I am having the same problem in 2019.3.
Is there a way to check bug reports and see if it’s still open?

Same issue in 2020.3.48f1. Is the bug tracking link available? Was this fixed?

Extremely unlikely. Consider, for example, this caveat:

If one is a newcomer to any mature tech it’s most productive to always assume you don’t understand something about it yet - or - the bug is in your code or data.