Spawn Prefab Action
An action to spawn a prefab at either a gameobject's position and rotation or a fixed position and rotation in the world.
The action can be given multiple different prefabs to spawn. The prefab spawned when the action is invoked is chosen randomly. The prefab will be spawned at the position of all targets provided if using the Advanced Target option. A position/rotation offset can be provided. This is in local space if Parent To Target is enabled, or world space otherwise.
A prefab can also/alternatively be spawned at a provided position and rotation. This position/rotation is in world space. If you want to spawn multiple prefabs at different world positions, use multiple Spawn Prefab Actions, or use empty gameobjects as spawn points and set them as targets.
Action Settings
Property | Description |
---|---|
Prefabs | The prefab(s) to be spawned. Setting multiple will cause the spawned prefab to be chosen at random from the list. |
Parent To Target | When enabled, the spawned prefab will be spawned as a child of the target gameobject. This means it will be spawned with a position/rotation relative to the target, and will move with the target. |
Target Position Offset | An offset to the prefab's position when spawned. If using Parent To Target, this is in local space relative to the target. Otherwise, this is in world space relative to the target. |
Target Rotation Offset | An offset to the prefab's rotation when spawned. If using Parent To Target, this is in local space relative to the target. Otherwise, this is in world space relative to the target. |
Spawn At Position | Spawns the prefab at a specific point in the world. NOTE: This is in addition to the spawning of prefabs at each of the targets set. Make sure there are no targets if you just want to spawn a prefab at a specific world position. |
Position | The position in world space to spawn this prefab at. |
Rotation | The x,y,z Euler rotations (degrees) in world space to spawn this prefab at. |