So my question today is what’s the most efficient way to grab all GameObjects at a certain position, let us say 1x1x1, and toss them into a list. My problem is that despite searching, I couldn’t fund a procedure/function which would grab objects at a certain position.
At the moment, I simply just grab all GameObjects with a certain tag in the world and toss them into a list. And then search for their position. But I feel that’s inefficient when I’m going to be dealing with a ton of these objects and it still isn’t necessarily what I want.
I don’t think there would be a huge difference in the ways you mentioned anyway. As I see it you would have to test each object/tagged objects you want to test against your given position anyway.
Also, keep in mind that with floating point values as the positions, it will be difficult to test for an exact position at times depending on your positioning method, so I suggest getting a vector from object position to test position and test its length against a small value.