Возвращает массив копий всех частиц и назначает его в качестве текущих частиц.
Note that after modifying the particles array you must assign it back to the particleEmitter to see the change. Particles with energy of zero or less will be killed when assigning the particles. Thus when creating a complete new particle array, you need to set the energy of all particles explicitly.
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public ParticleEmitter emitter; void Start() { emitter = GetComponent<ParticleEmitter>(); } void LateUpdate() { Particle[] particles = emitter.particles; int i = 0; while (i < particles.Length) { float yPosition = Mathf.Sin(Time.time) * Time.deltaTime; particles[i].position += new Vector3(0, yPosition, 0); particles[i].color = Color.red; particles[i].size = Mathf.Sin(Time.time) * 0.2F; i++; } emitter.particles = particles; } }