Esempio n. 1
0
        public void SpawnPrefab()
        {
            // Randomly calculate a position
            var position = (Vector3)Random.insideUnitCircle * 6.0f;

            // Spawn a prefab clone
            var clone = LeanPool.Spawn(Prefab, position, Quaternion.identity, null);

            // Despawn it with a delay
            LeanPool.Despawn(clone, DespawnDelay);
        }
Esempio n. 2
0
        public void SpawnPrefab()
        {
            var position = (Vector3)Random.insideUnitCircle * 6.0f;
            var clone    = LeanPool.Spawn(Prefab, position, Quaternion.identity, null);

            // Add the clone to the clones stack if it doesn't exist
            // If this prefab can be recycled then it could already exist
            if (spawnedPrefabs.Contains(clone) == false)
            {
                spawnedPrefabs.Push(clone);
            }
        }
Esempio n. 3
0
        public void Spawn()
        {
            BeginBenchmark();
            {
                for (var i = 0; i < Count; i++)
                {
                    var position = (Vector3)Random.insideUnitCircle * 6.0f;
                    var clone    = LeanPool.Spawn(Prefab, position, Quaternion.identity, null);

                    spawnedPrefabs.Add(clone);
                }
            }
            EndBenchmark("Spawn");
        }