> For the complete documentation index, see [llms.txt](https://quasistellar-game-development.gitbook.io/town-generator/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://quasistellar-game-development.gitbook.io/town-generator/tutorials/building-setup.md).

# Building Setup

Buildings are set-up to indicate where doors are and where adjacent buildings can be placed using Attachment Points. Specify max height difference for adjacent buildings for better randomized results.

### Tutorial

{% embed url="<https://www.youtube.com/watch?v=V0G6PN1w4HU>" %}

*PS: While this video tutorial is a bit out-dated, it is still relevant. See updated instructions below using the added quick buttons.*

1. Create a Prefab of your Building Model.
2. Add the Building Script to your Building Prefab.

   <figure><img src="https://1310469529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgVvtcxAkBvvpXDNOV9oM%2Fuploads%2FwsLQesj2RuVMGn6Dfuq9%2F2_building_setup.png?alt=media&amp;token=7e5141eb-78bd-441c-a295-253c25c7e098" alt=""><figcaption></figcaption></figure>
3. Make sure the building model is at the correct height using a 3D Plane. Position the Plane at zero and check that your building doors are at a good height relative to the Plane as if the Plane is the Terrain. Then Delete the Plane again.

   <figure><img src="https://1310469529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgVvtcxAkBvvpXDNOV9oM%2Fuploads%2F2A0fLG302pQccfLk8IWP%2F3_building_setup.png?alt=media&amp;token=7b23e0e1-ac07-47e6-a90c-d7a6879d4898" alt=""><figcaption></figcaption></figure>
4. Open the Functions tab of the Building Component:

   <figure><img src="https://1310469529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgVvtcxAkBvvpXDNOV9oM%2Fuploads%2F97IyhRrMpe4pP6YFNzmE%2Fimage.png?alt=media&amp;token=d521b0ea-71b1-4b73-93a1-fb48601e6187" alt=""><figcaption></figcaption></figure>
5. Click Door under the Create Other heading.
6. Position the Door prefab at the correct position of your Building model. Duplicate it for all the doors of your model. You may need to resize the Trigger Collider to fit the size of your doors.

   <figure><img src="https://1310469529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgVvtcxAkBvvpXDNOV9oM%2Fuploads%2FXhaEHBNdrFtizikpner3%2F5_building_setup.png?alt=media&amp;token=b93dbd36-e0e1-4916-b51b-59901e4dc22d" alt=""><figcaption></figcaption></figure>
7. Next use the Create Attach Points section to easily add AttachPoints to your building.<br>

   <figure><img src="https://1310469529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgVvtcxAkBvvpXDNOV9oM%2Fuploads%2FzOsKRbhttV9q28exgcKk%2Fimage.png?alt=media&amp;token=e1a4eedd-1eef-474e-9ddd-36b741391c90" alt=""><figcaption></figcaption></figure>
8. Position the AttachPoints where you would like adjacent buildings to be generated. You can keep AttachPoints at zero height, or on the ground. All AttachPoints of the same Building-Set should be at the same height.

   <figure><img src="https://1310469529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgVvtcxAkBvvpXDNOV9oM%2Fuploads%2FbEJ8AtBWUDshBfBzys1f%2F7a_building_setup.png?alt=media&amp;token=ffa26771-c589-46f9-b425-e74b8294450b" alt=""><figcaption></figcaption></figure>
9. Duplicate the AttachPoint and add as many as you like.

   <figure><img src="https://1310469529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgVvtcxAkBvvpXDNOV9oM%2Fuploads%2FTjzNo3oKyrNVGWzToUCQ%2F7b_building_setup.png?alt=media&amp;token=87ef7162-dafc-4dd3-9b58-e529efc08a9c" alt=""><figcaption></figcaption></figure>
10. Change the preferred Maximum Height Difference (the default is 1.0) for each AttachPoint on the AttachPoint Component.
11. Save your Prefab
