言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

ParticleEmitter.particles

Switch to Manual
public var particles: Particle[];

Description

全てのパーティクルのコピーし、現在のパーティクルとなる全てのパーティクルを割り当てて返します

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.

	// Attach this script to an existing particle emitter.

	function LateUpdate () {
		// extract the particles
		var particles = particleEmitter.particles;
		for (var i = 0; i < particles.Length; i++) {
			// Move the particles up and down on a sinus curve
			var yPosition = Mathf.Sin (Time.time) * Time.deltaTime;
			particles[i].position += Vector3 (0, yPosition, 0);
			// make the particles red
			particles[i].color = Color.red;
			// modify the size on a sinus curve
			particles[i].size = Mathf.Sin (Time.time) * 0.2;
		}
		// copy them back to the particle emitter
		particleEmitter.particles = particles;
	}