Difference between revisions of "SpawnBehavior"

From Headbone Creative
Jump to: navigation, search
(Initial page, includes API information and categories)
 
(Initial page, includes API information and categories)
 
Line 8: Line 8:
 
=== maxSpawns : int ===
 
=== maxSpawns : int ===
 
This is the maximum number of prefabs to spawn.  
 
This is the maximum number of prefabs to spawn.  
// how many seconds to wait before spawning another
+
=== spawnDelay : float ===
public float spawnDelay = 3.0f;
+
This is how many seconds to wait between spawning prefabs.
// How close the player must be to spawn. -1 means infinite range.
+
=== spawnRange : float ===
public float spawnRange = 1.0f;
+
How close the player must be before the object will be spawned. Set to -1 for infinite range.  
// What is the target's identifier?
+
=== targetTag : string ===
public string targetTag = "Player";
+
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.
// cache a pointer to the player object.
+
=== target : GameObject ===
public GameObject target;
+
This is the object that must be in range before objects will be spawned, if '''spawnRange''' is greater than 0.  
// Add support for displaying something before the spawn (pre-spawn!)
+
=== spawnWarningPrefab : GameObject ===
public GameObject spawnWarningPrefab;
+
This is an object that will be spawned for a short time before the actual prefab is spawned.
// how long to leave the pre-spawn warning object alive.
+
=== spawnWarningTime : float ===
public float spawnWarningTime = 1.0f;
+
This is how long (in seconds) to leave the spawn warning object alive.
  
 
[[Category:API]]
 
[[Category:API]]
 
[[Category:Premium Scripts]]
 
[[Category:Premium Scripts]]
 
[[Category:Utility]]
 
[[Category:Utility]]

Latest revision as of 03:35, 21 April 2013

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.

Contents

[edit] Public Variables

[edit] prefabToSpawn : GameObject

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

[edit] theParent : Transform

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

[edit] maxSpawns : int

This is the maximum number of prefabs to spawn.

[edit] spawnDelay : float

This is how many seconds to wait between spawning prefabs.

[edit] spawnRange : float

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

[edit] 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.

[edit] target : GameObject

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

[edit] spawnWarningPrefab : GameObject

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

[edit] spawnWarningTime : float

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

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox