Is this a pooling script or not?
is this a pool script
and does a pool script have to use the words pool pooled object pooling in the code I think so please clarify
2d game
#pragma strict
public var spawnFrequency: float = 3f; // 3 seconds
public var prefab: GameObject;
var Spawns : Transform[];
function Start () {
//Instantiate( prefab, Spawns[Random.Range( 0, 3)].position, Spawns[3].rotation);
if (prefab != null)
{
// InvokeRepeating("SpawnItem", 1.0f, 4.0f spawnFrequency);
// Starting in 2 seconds.// a projectile will be launched every 0.3 seconds
InvokeRepeating("SpawnItem", 3.0f, 6.0f );
}
}
function SpawnItem () {
if (prefab != null)
{
if (Spawns.Length >= 2)
{
Instantiate( prefab, Spawns[Random.Range( 2, Spawns.Length)].position, Spawns[0].rotation);
}
else
{
Instantiate( prefab );
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Instantiate GameObject Error I dont know whats wrong with it seems right to me 1 Answer
How to reuse prefab bullet when it hits a collider using pool 0 Answers
My pooling stops after a while , please help 0 Answers
Pooled Objects on wrong scene 0 Answers
Object pooling with different type of enemies problem. C# 1 Answer