Difference between revisions of "SpawnBehavior"

From Headbone Creative
Jump to: navigation, search
(Initial page, includes API information and categories)

Revision as of 21:17, 20 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

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. // how many seconds to wait before spawning another public float spawnDelay = 3.0f; // How close the player must be to spawn. -1 means infinite range. public float spawnRange = 1.0f; // What is the target's identifier? public string targetTag = "Player"; // cache a pointer to the player object. public GameObject target; // Add support for displaying something before the spawn (pre-spawn!) public GameObject spawnWarningPrefab; // how long to leave the pre-spawn warning object alive. public float spawnWarningTime = 1.0f;

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox