My pooling stops after a while , please help
I have this script and it does pool I see pool in scene clone as they pool and are created, but after a while the pooling stops I want the pooling to continue forever , I do have a few instantiate scripts heres 1 of the scripts
I just cant seem to figure out how to keep the instantiating /pooling to continue
2d
#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 );
}
}
}
does the script or it's gameobject get disabled at some point?
the gameobject with this script should be active in the scene and the script itself should have its checkbox ticked. the script is simple enough that it should work on its own correctly.
Your answer
Follow this Question
Related Questions
Can someone post a generic object pool script? 4 Answers
How do I set up object pooling in a 2d endless runner? (New to unity) 0 Answers
All objects spawns with the same color but their material is different! HELP! 0 Answers
Bullet not going in the direction which it is facing. 0 Answers
Please help my pool script doesnt work. 0 Answers