-
Notifications
You must be signed in to change notification settings - Fork 15
SKGAttachmentComponent
The purpose of this component is to allow for an easy way to manage an attachment on an individual level. It ties directly with the attachment manager (which is optional) as they can work hand in hand allowing a easy to use, yet robust attachment system.


This is the name of the mesh component for the attachment to be attached to. In the case of this example with the sight, it is the SkeletalMesh for the M4.

This is the name of the socket on the mesh for the attachment to attach to. In the case of this example with the sight, it is the S_Attach_Optic on the M4's mesh.

This is an optional section, it is useful for making customization menus.
This is an optional section, it is useful for making customization menus.

This is used for customization menus. In the example I use it for essential parts such as the barrel and handguard so they cannot be removed in the customization menu.
This is useful if you are using the attachment system for characters. When the attachment is attached (lets assume a shirt), it will automatically set the leader pose component for you with the Leader Pose Attachment Mesh Name.
This is the name of the mesh component to be used with the above Auto Set Leader Pose Component setting.
If this is true, a random attachment will be used from the Compatible Attachments and setup upon spawn.
If set, this will spawn the specified attachment automatically upon spawn only if the attachment is compatible based on the setting below.
This is an array of data assets. In each data asset you define what attachments are allowed in each asset, then you can use them in combination with each other. Leave this empty if you want all attachments to be compatible.


If this is true, clients can add/remove attachments. If it is false and a cheater attempts to do it (such as calling the RPC directly) it will disconnect the client.

If true, each time an offset is applied to the attachment it will replicate. I recommend leaving this off. If it is off, FinalizeAttachmentOffset will need to be called to replicate.
This setting allows for you to define the direction you wish to move the attachment in the XYZ.
This setting is useful for rail sections. For example, if you move an optic up/down a rail you cannot move it freely because picatinny slots are spaced 1.046cm apart.
This is how far in the reverse direction the attachment is allowed to move. For example by default a sight might be all the way back, so this value would be 0 so it can only be moved forwards, but a collapsible stock like in the example can be moved back so it will have a value of -4.
This is how far in the forward direction an attachment is allowed to move. For example a sight moving down the rail.
These are the rules that are applied when AttachToComponent is called. Default values here are sufficient but still customizable incase you need something different.
This function will load the passed in soft pointer to a class asynchronously. Once loaded it will try to spawn, setup, and attach the attachment.
This function will try to spawn, setup, and attach the attachment from the passed in class.
This function will try to setup and attach the passed in attachment.
This function will try to setup the passed in attachment without attaching it. This is useful if you are using other systems that handle the attaching already.
This function will remove the attachment from the system, but it will not detach or destroy it. This is useful if you are going to be dropping this attachment to the ground or adding it to an inventory or just passing it along to another system.
This function will remove the attachment from the system and destroy it.
This function will return true if it holds a valid attachment registered with the system.
This function will return the created list of compatible attachments defined in Compatible Attachments.
This function is overridable. By default it will return true if the passed in class is compatible with the attachments defined in Compatible Attachments.
This function is overridable. By default it will return true if the passed in attachment is compatible with the attachments defined in Compatible Attachments.
This function will create a locally spawned preview of the given attachment class you pass in. If there is an existing attachment it will simply hide it to only display the preview.
This function will destroy the spawned preview attachment. If there is an existing attachment it will unhide it so everything is back to normal.
This function is used when Replicate Offset Each Change is set to false. This must be called to replicate the offset.
This function will set the offset for the attachment to the passed in value. It is clamped between Minimum Offset Allowed and Maximum Offset Allowed and utilizes the Offset Snap Distance to jump to the nearest snap point if defined.
This function will increment the offset by the Offset Snap Distance. It is clamped between Minimum Offset Allowed and Maximum Offset Allowed.
This function will decrement the offset by the Offset Snap Distance. It is clamped between Minimum Offset Allowed and Maximum Offset Allowed.
This function returns true if an offset can be applied (if Minimum Offset Allowed and Maximum Offset Allowed are not equal).
This function returns the offset world transform of the attachment (where the Attach To Socket with the offset applied).
This function returns the world transform of the attachment attach point (where the Attach To Socket with the offset applied).
This function returns the start offset defined by Minimum Offset Allowed world transform of the attachment (where the Attach To Socket with the Minimum Offset Allowed applied).
This function returns the start offset defined by Maximum Offset Allowed world transform of the attachment (where the Attach To Socket with the Maximum Offset Allowed applied).
This function returns an array of all the possible snap points defined by the range of Minimum Offset Allowed and Maximum Offset Allowed spaced by Offset Snap Distance.
This function returns the Attach To Socket.
This function returns the Component Name.
This function returns the Component Image.
This function returns the Default Attachment.
This function returns the Attach To Mesh Name.
This function returns the currently registered attachment.
This function returns the current attachment offset.
This function returns whether or not the attachment component is specified to be a required attachment to function.
This function returns the Offset Settings.
This event will fire each time a attachment is registered
This event will fire each time the registered attachment is removed
This event will fire each time the registered attachment is destroyed
This event will fire each time the registered attachment is changed
This event will fire each time the Attachment Offset is changed.