Spawn Prefab Action: Difference between revisions
No edit summary |
(Updated image and added table of settings) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
An action to spawn a prefab at a gameobject's position and rotation. | An action to spawn a [[Prefab Asset|prefab]] at either a [[Gameobject|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 | 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 Action]]s, or use empty gameobjects as spawn points and set them as targets. | |||
== Action Settings == | |||
[[File:SpawnPrefabAction.png|thumb|right|600px|A Spawn Prefab action that will randomly choose between two prefabs to spawn at three transform positions.]] | |||
{| class="wikitable" | |||
|- | |||
! 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. <br/>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. | |||
|- | |||
| style="padding-left: 2em;" | '''Position''' || The position in world space to spawn this prefab at. | |||
|- | |||
| style="padding-left: 2em;" | '''Rotation''' || The x,y,z Euler rotations (degrees) in world space to spawn this prefab at. | |||
|- | |||
|} | |||
[[Category:Actions]] | [[Category:Actions]] |
Latest revision as of 00:08, 5 April 2023
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. |