Это скрипт Particle. Я установил
Код: Выделить всё
using System.Collections.Generic;
using UnityEngine;
public class Particle : MonoBehaviour
{
public Vector3 position;
public Vector3 velocity;
public Vector3 gravityAcceleration = new Vector3(0, -9.81f, 0);
public float lifespan = 5f;
void Start()
{
velocity = new Vector3(Random.Range(-2f, 2f), Random.Range(-2f, 2f), Random.Range(-2f, 2f));
}
// Update is called once per frame
void Update()
{
// Update position and velocity
velocity += gravityAcceleration*Time.deltaTime;
transform.position += velocity*Time.deltaTime;
// Decrease the lifespan of the particle
lifespan -= Time.deltaTime;
if (lifespan = 1f / particleRate) {
CreateParticle();
timer = 0f;
}
}
}
пример продолжительности жизни = 2 секунды.
Подробнее здесь: https://stackoverflow.com/questions/792 ... a-unity-cu