- Home /
Editor Script renderer.bounds.intersect does not work
Hi there, i am working on a city Builder which can be run in editor. Road generation and Building generation (i am using simple cubes for both the roads and the structures atm) works fine. Now i wan't to achieve that my buildings, dont intersect with my streets. The Problem is the Debug log says that all the roads are intersecting, which is not true. The code i tried is the following:
foreach (GameObject gO in GameObject.FindObjectsOfType(typeof(GameObject)) as GameObject[])
{
if (gO.name.ToLower().Contains("road"))
{
if (this.gBuilding.transform.renderer.bounds.Intersects(gO.transform.renderer.bounds))
{
Debug.Log(gO.transform.name + ": " + gO.transform.renderer.bounds);
}
}
}
The debug log says Center(0.0,0.0,0,0) Extends(0.0,0.0,0.0), and it is always the same road. I used this method to destroy my streets and Buildings with a Button. There it works fine
Your answer
![](https://koobas.hobune.stream/wayback/20220613150600im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Initialising List array for use in a custom Editor 1 Answer
Multiple Cars not working 1 Answer
How do I wait until after AssetDatabase creates an assets before carrying out another function ? 0 Answers
Stop a MonoBehavior from being addable as a script? 0 Answers