RayCastHit[] Array looped?

I’m having a hell of a fun time with RayCastHit.

I’m trying to do some code that loops hit = Physics.RayCastAll, where hit : RayCastHit; The thing is, since built in arrays are not reusable, Once it does the loop once, its done, and then it will just return null for the rest of code, because it is stuck with old variables(int). I could clear the array, set it to null, even resize it, but it just doesnt work like that. I wish I could just return a List of RayCastHits. How can I loop through it?

Hello,

It seems you have mixed up your logic when it comes to looping through the results of a RaycastAll. You need to loop through the return value of the function, not a loop of function executions.

Hope this helps,
Benproductions1