ModularFirearmAttachmentSocket MonoBehaviour
Overview
The ModularFirearmAttachmentSocket behaviour represents a socket into which an attachment can be installed. It allows you to install attachments via their prefab or ID.
Sockets can be nested within attachments. An example would be a shotgun with different length barrel attachments. Each of those could have a muzzle tip socket that can store suppressors or chokes. If the barrel attachment is swapped, then the attachment in the muzzle tip socket will be transferred into the socket on the new barrel and realigned, as long as the socket names match.
Inspector

Properties
| Name | Type | Description |
|---|---|---|
| Socket Name | String | The name for this socket (eg Optics or Muzzle). This will be used to identify the socket to the attachment system, but could also be used in any attachment UI. |
| Default Attachment Source | Dropdown | Where is the default attachment taken from. None means the socket will start empty. This means you can select one of the attachments specified in this component. Group allows you to select one of the attachments from the provided group asset. Random means the socket will start with a random attachment from the combined options on this component and in the group. |
| Default Attachment | Dropdown | Allows you to select which attachment to pick from the default source specified above. |
| Attachment Group | ModularFirearmAttachmentGroup | A reusable group of attachments that can be attached to this socket. Its contents will be appended to the attachments listed below. |
| Attachments | Attachment Array | An array of available attachments. The attachments from the attachment group above will be appended to this. |
| Socket Filled Object | GameObject | (Optional) An object that will be active when the attachment slot is filled. Examples would be a mounting rail or folded iron sights. |
| Socket Empty Object | GameObject | (Optional) An object that will be active when the attachement slot is empty. This could be a fallback attachment if required. |
| Null Attachment Name | String | The display name that should be used for the attachment when the socket is empty (null attachmnet assigned). |
| On Attachment Changed | [UnityEvent][unity-events] | An event fired when the attachment is changed. If you point this at a method that takes a ModularFirearmAttachment parameter, then the new attachment will be sent to the method whenever the event is fired. |