Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float numberOfConcurrentItems = 100;
- float lifeSpan = 5; // in seconds
- float spawnPeriod;
- float nextEmitTime;
- void Start() {
- nextEmitTime = Time.time;
- spawnPeriod = 1.0f / ( numberOfConcurrentItems / lifeSpan );
- }
- void Update() {
- if (Time.time > nextEmitTime)
- {
- nextEmitTime += spawnPeriod;
- Emit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment