Download the example here: http://bit.ly/pcgbasicsrepo
In this video we learn how to spawn objects randomly while preventing them overlapping objects using a physics technique called a box cast. We can prevent two things from being spawned into the same place by casting a box into that space and checking if it overlaps with anything already there. unity procedural generation boxcast c# unity tutorial unity3d
Source