From Headbone Creative
Jump to: navigation, search

This script is used to spawn objects into the scene repeatedly. It also supports showing a warning object in the scene before the actual object is spawned.


Public Variables

prefabToSpawn : GameObject

This should be set in the editor to a prefab that will be spawned into the scene.

theParent : Transform

This is optional - if set, the objects that are spawned will set this as their parent.

maxSpawns : int

This is the maximum number of prefabs to spawn.

spawnDelay : float

This is how many seconds to wait between spawning prefabs.

spawnRange : float

How close the player must be before the object will be spawned. Set to -1 for infinite range.

targetTag : string

This is the tag of the player object. If set and target is null when the scene starts, the first object found with this tag will be used.

target : GameObject

This is the object that must be in range before objects will be spawned, if spawnRange is greater than 0.

spawnWarningPrefab : GameObject

This is an object that will be spawned for a short time before the actual prefab is spawned.

spawnWarningTime : float

This is how long (in seconds) to leave the spawn warning object alive.

Personal tools