기술 자료

Unity Engine

Unity Engine

rateOverDistance

The rate at which the emitter spawns new particles over distance.
읽는 시간 1분최근 업데이트: 한 달 전

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.ParticleSystemModule
public ParticleSystem.MinMaxCurve rateOverDistance { get; set; }

Remarks

The emitter only spawns new particles when it moves. If the system's GameObject contains a Rigidbody or Rigidbody2D component, and the system's Emitter Velocity property is set to Rigidbody, Unity calculates the distance based on the velocity of the Rigidbody. Otherwise, Unity calculates the distance based on how far the GameObject's Transform component has moved since the last update. Additional Resources: ParticleSystem.MinMaxCurve, ParticleSystem.EmissionModule.rateOverTime, ParticleSystem.MainModule.emitterVelocityMode.

Examples

using UnityEngine;using System.Collections;[RequireComponent(typeof(ParticleSystem))]public class ExampleClass : MonoBehaviour{ private ParticleSystem ps; public float hSliderValue = 5.0f; void Start() { ps = GetComponent<ParticleSystem>(); var main = ps.main; main.simulationSpace = ParticleSystemSimulationSpace.World; var shape = ps.shape; shape.enabled = false; var emission = ps.emission; emission.rateOverTime = 0.0f; // add a sphere so we can see our transform position as it moves var sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere); sphere.transform.parent = ps.transform; } void Update() { var emission = ps.emission; emission.rateOverDistance = hSliderValue; ps.transform.position = new Vector3(Mathf.Sin(Time.time) * 2.0f, 0.0f, 0.0f); } void OnGUI() { hSliderValue = GUI.HorizontalSlider(new Rect(25, 45, 100, 30), hSliderValue, 1.0f, 20.0f); }}