public float sizeMultiplier;
Описание
Множитель для ParticleSystem.SizeBySpeedModule.size.
Изменение этого свойства более эффективно, чем доступ ко всей кривой, если вы хотите изменить только множитель общего размера.
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(ParticleSystem))]
public class ExampleClass : MonoBehaviour
{
private ParticleSystem ps;
public float hSliderValue = 1.0f;
void Start()
{
ps = GetComponent<ParticleSystem>();
var sizeBySpeed = ps.sizeBySpeed;
sizeBySpeed.enabled = true;
sizeBySpeed.sizeMultiplier = 1.0f;
sizeBySpeed.range = new Vector2(0.9f, 5.0f);
var psr = GetComponent<ParticleSystemRenderer>();
psr.material = new Material(Shader.Find("Sprites/Default")); // this material renders a square billboard, making it easier to see the size
}
void Update()
{
var main = ps.main;
main.startSpeed = hSliderValue;
}
void OnGUI()
{
hSliderValue = GUI.HorizontalSlider(new Rect(25, 45, 100, 30), hSliderValue, 1.0f, 5.0f);
}
}