So I have a terrain mesh being generated through a series of scripts, it is infinite and works well for what it. The problem lies when adding trees, at first I tried making them spawn on only on a certain colour (green being grass) but to no success, next, I tried making them spawn then drawing a raycast down from each tree and moving them to that position but again to no success. Finally, I decided to spawn them above when the terrain would spawn and then using Ridgidbody.gravity to make them drop and freezing them at the position the hit which works, along side collision detection for if the collide with say a mountain or each other. This system works but as you would imagine have 1000+ trees spawning and falling for 1 seconds is quite laggy and takes about 5 seconds to balance out.
My question is could anyone think of a better way to do this.
Thanks