Version: 2022.2
LanguageEnglish
  • C#

ParticleSystem.NoiseModule.positionAmount

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public ParticleSystem.MinMaxCurve positionAmount;

Description

How much the noise affects the particle positions.

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(ParticleSystem))] public class ExampleClass : MonoBehaviour { private ParticleSystem ps; public float hSliderValuePositionAmount = 1.0f; public float hSliderValueRotationAmount = 0.0f; public float hSliderValueSizeAmount = 0.0f;

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); } }