Next: , Previous: , Up: Inventory   [Contents][Index]


10.3 Minion Spawn

Component: MinionSpawn

This component handles the unique case when you are able to spawn minions from inventory items. It will return the item to inventory if spawning fails. To use it, attach it to an empty object that is instantiated at ’Instantiation Transform’ when used from inventory. If the criteria for spawning are met, it will destroy itself and spawn a minion, otherwise it will return the item to your inventory. This system does not work with object pooling.

Field of MinionSpawn: LayerMask rayMask

What objects should we look for to spawn on? This performs a raycast straight down to find out if we’re deploying onto a valid surface. Generally, this will occur at the Instantiation Transform designated on the Inventory component.

Spawn Settings

Field of MinionSpawn: float rayDistance

How far down from the origin are we willing to look for a surface to spawn on?

Default value: 2.0f

Field of MinionSpawn: GameObject minion

Unit we are attempting to spawn

Field of MinionSpawn: GameObject activeObject

A reference to an inventory item that will be added back in to the inventory in case we fail to spawn anything

Field of MinionSpawn: LayerMask rayMask

What objects should we look for to spawn on? This performs a raycast straight down to find out if we’re deploying onto a valid surface. Generally, this will occur at the Instantiation Transform designated on the Inventory component.

Spawn Settings

Field of MinionSpawn: float rayDistance

How far down from the origin are we willing to look for a surface to spawn on?

Default value: 2.0f

Field of MinionSpawn: GameObject minion

Unit we are attempting to spawn

Field of MinionSpawn: GameObject activeObject

A reference to an inventory item that will be added back in to the inventory in case we fail to spawn anything


Next: , Previous: , Up: Inventory   [Contents][Index]