Make this algorithm more efficient

unitys cullinggroup can be also used to collect nearby objects, example here: