Okay, so, I’m making a procedural generation system, And I need each tile to know it’s nearest neighbor, but for that I need to either make a public game object in the procedural generation script and assign it manually (which takes an unbelievable amount of time) or make the script assign it based on it’s position. The problem is that I don’t know how to do the second, and searching it on the internet yielded no results. How do I do that?
You can divide the world into multiple boxes, then use Physics.OverlapBoxNonAlloc to get all objects in the Box, then find the nearest object
Or you can implement some space partitioning algorithms yourself (BVH, etc.), to search the nearest object by yourself
This might help you