> For the complete documentation index, see [llms.txt](https://mindcodeinteractive.gitbook.io/easy-build-system-old/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mindcodeinteractive.gitbook.io/easy-build-system-old/components/building-socket.md).

# Building Socket

Handles the snapping of [Building Parts](/easy-build-system-old/components/building-part.md) according they offset position, rotation or scale.

It is possible to create new snapping points within each socket to enable snapping of a specific [Building Part](/easy-build-system-old/components/building-part.md) onto it.

When a [Building Socket](/easy-build-system-old/components/building-socket.md) is occupied by a Building Part, it becomes reserved for that "Type".\
This meaning that no other [Building Parts](/easy-build-system-old/components/building-part.md) of the same type can be attached to it as long as the [Building Part](/easy-build-system-old/components/building-part.md) is present on the socket.

{% hint style="info" %}
Explore fields description in the Inspector by hovering your cursor over them.\
You can find more information about this here: [Tooltip Attribute](https://docs.unity3d.com/ScriptReference/TooltipAttribute.html).
{% endhint %}

***

## API

You can access this class by including the following namespace:

```csharp
using EasyBuildSystem.Features.Runtime.Buildings.Socket;
```

Here is a list of all the events and methods of this component that can be called:

{% tabs %}
{% tab title="Methods" %}

#### Methods

<pre class="language-csharp"><code class="lang-csharp">/// &#x3C;summary>
/// Get the snapping point settings that can fit the specified Building Part.
/// &#x3C;/summary>
/// &#x3C;param name="part">The Building Part to check for snapping points.&#x3C;/param>
/// &#x3C;returns>The snapping point settings that can fit the Building Part.&#x3C;/returns>
SnappingPointSettings snapSettings = GetOffset(BuildingPart part);

/// &#x3C;summary>
/// Snap a preview to a specified snapping point settings with an offset rotation.
/// &#x3C;/summary>
/// &#x3C;param name="buildingPart">The Building Part to be snapped.&#x3C;/param>
/// &#x3C;param name="offsetSettings">The snapping point settings to snap to.&#x3C;/param>
/// &#x3C;param name="offsetRotation">The offset rotation to apply to the snapped Building Part.&#x3C;/param>
/// &#x3C;returns>True if the snap operation is successful, false otherwise.&#x3C;/returns>
Snap(BuildingPart buildingPart, SnappingPointSettings offsetSettings, Vector3 offsetRotation);

/// &#x3C;summary>
/// Check if this Building Part can fit with the specified Building Part.
/// &#x3C;/summary>
/// &#x3C;param name="buildingPart">The Building Part to check for fit.&#x3C;/param>
/// &#x3C;returns>True if the Building Part can fit, false otherwise.&#x3C;/returns>
bool canFit = IsFitting(BuildingPart buildingPart);

<strong>/// &#x3C;summary>
</strong>/// Check if the socket is busy with the specified Building Part.
/// &#x3C;/summary>
/// &#x3C;param name="part">The Building Part to check for occupancy.&#x3C;/param>
/// &#x3C;returns>True if the socket is busy, false otherwise.&#x3C;/returns>.
bool isBusy = IsBusy(BuildingPart buildingPart);
</code></pre>

{% endtab %}
{% endtabs %}

All of the methods related to this component can be found in the file "BuildingSocket.cs".\
If you have any specific questions about the API, feel free to contact us.
