Alrighty this might be a tough question, I searched around online but the only question on this that I found ended up not having a right answer, so here goes.
I have a random generation thing set up where basically, when the scene starts, one room is randomly instantiated. Then that room creates hallways coming off of it, and those hallways create rooms on the end of them, and those rooms create more hallways, on and on until a certain limit is reached. The obvious problem that I have here is rooms being instantiated on top of other rooms, or hallways cutting through other hallways, etc. And obviously, this won’t work well for a video game. So I can’t post all 5 scripts I have that do this, but basically this is the line of code I am using to instantiate whatever object.
What I want is to check before doing this code whether or not there is already an object where it is going to instantiate, or whether or not it is going to overlap another object. I can’t just check for an object at the spawnPos, because that won’t stop a hallway from overlapping another hallway. I need it to check whether or not it will overlap another object before it instantiates. Is there any possible way to do this? Thanks in advance, I know this is probably a tough question.