Version: 2017.2
public ParticleSystem.MinMaxCurve sizeAmount ;

描述

噪声对粒子大小的影响程度(用作每个粒子大小的乘数)。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { private ParticleSystem ps; public float hSliderValuePositionAmount = 0.0f; public float hSliderValueRotationAmount = 0.0f; public float hSliderValueSizeAmount = 0.5f;

void Start() { ps = GetComponent<ParticleSystem>();

var noise = ps.noise; noise.enabled = true;

var psr = GetComponent<ParticleSystemRenderer>(); psr.material = new Material(Shader.Find("Sprites/Default")); // this material renders a square billboard, so we can see the rotation }

void Update() { var noise = ps.noise; noise.enabled = enabled; noise.positionAmount = hSliderValuePositionAmount; noise.rotationAmount = hSliderValueRotationAmount; noise.sizeAmount = hSliderValueSizeAmount; }

void OnGUI() { GUI.Label(new Rect(25, 80, 100, 30), "Position Amount"); GUI.Label(new Rect(25, 120, 100, 30), "Rotation Amount"); GUI.Label(new Rect(25, 160, 100, 30), "Size Amount");

hSliderValuePositionAmount = GUI.HorizontalSlider(new Rect(135, 85, 100, 30), hSliderValuePositionAmount, 0.0f, 5.0f); hSliderValueRotationAmount = GUI.HorizontalSlider(new Rect(135, 125, 100, 30), hSliderValueRotationAmount, 0.0f, 180.0f); hSliderValueSizeAmount = GUI.HorizontalSlider(new Rect(135, 165, 100, 30), hSliderValueSizeAmount, 0.0f, 1.0f); } }