Last updated: Sep 7, 2022
The Attachment Behaviour component handles the spawning of all attachments in the asset. These are the parts that get attached to the items in the demo scenes. This is naturally a really important part of the product, and so we’ve put special care on this!
This script also handles applying the correct Skin to the Attachments after spawning them, and takes into account everything needed!
You can find the Attachments script ****at this path: Assets\Infima Games\Low Poly Animated - Modern Guns\Demo\Code\Attachments\Attachments.cs
Weapon Skinner. The component that applies a Skin to this GameObject. We use this to apply the Skin after all attachments are spawned.
Sockets. Contains references to all the item's socket points.
Data. ScriptableObject containing all the required information on what Attachments to spawn.
Spawning. This boolean value tells us if this component is currently in the middle of spawning attachments or not.
Attachments. List of all spawned attachments.
Get Variant. Returns the Attachment variant that was spawned for the given Type input.
Get Variant <T>. Returns a component on the Attachment variant that was spawned for the given Type input.
Get. Returns the Attachment value for a given Type.
Wait And Spawn. Waits until the end of the current frame before spawning all attachments again. We do this just in case there's some attachments left to clean up due to the Destroy method doing some weird things.
Wait And Apply Skin. Waits until all attachments are spawned before finally applying a skin to everything.
Spawn. Sets up for spawning all the Attachments.
Spawn All. Spawns all the Attachments in the given toSpawn List.