The type of shape to emit particles from.
using UnityEngine; using System; using System.Collections; using System.Collections.Generic;
[RequireComponent(typeof(ParticleSystem))] public class ExampleClass : MonoBehaviour { private ParticleSystem ps; public ParticleSystemShapeType shapeType = ParticleSystemShapeType.Cone; private int shapeTypeIndex = 2; public float arc = 360.0f; public ParticleSystemShapeMultiModeValue arcMode = ParticleSystemShapeMultiModeValue.Random; public float arcSpread = 0.0f; public float arcSpeed = 1.0f; public float angle = 25.0f; public float radius = 1.0f; public float radiusThickness = 1.0f; public ParticleSystemShapeMultiModeValue radiusMode = ParticleSystemShapeMultiModeValue.Random; public float radiusSpread = 0.0f; public float radiusSpeed = 1.0f; public float donutRadius = 0.2f; public float length = 2.0f; public Vector3 boxThickness = new Vector3(0.0f, 0.0f, 0.0f); public ParticleSystemMeshShapeType meshShapeType; public float normalOffset = 0.0f; public float randomizeDirection = 0.0f; public float spherizeDirection = 0.0f; public float randomizePosition = 0.0f; public Vector3 position = new Vector3(0.0f, 0.0f, 0.0f); public Vector3 rotation = new Vector3(0.0f, 0.0f, 0.0f); public Vector3 scale = new Vector3(1.0f, 1.0f, 1.0f);
void Start() { ps = GetComponent<ParticleSystem>();
var main = ps.main; main.startSpeed = 0.1f; main.startSize = 0.1f; main.startLifetime = 1.0f;
var emission = ps.emission; emission.rateOverTime = 500.0f;
var shape = ps.shape; shape.mesh = Resources.GetBuiltinResource<Mesh>("Capsule.fbx"); }
void Update() { var shape = ps.shape; shape.shapeType = shapeType; shape.arc = arc; shape.arcMode = arcMode; shape.arcSpread = arcSpread; shape.arcSpeed = arcSpeed; shape.angle = angle; shape.radius = radius; shape.radiusMode = radiusMode; shape.radiusSpread = radiusSpread; shape.radiusSpeed = radiusSpeed; shape.radiusThickness = radiusThickness; shape.donutRadius = donutRadius; shape.length = length; shape.boxThickness = boxThickness; shape.meshShapeType = meshShapeType; shape.normalOffset = normalOffset; shape.randomDirectionAmount = randomizeDirection; shape.sphericalDirectionAmount = spherizeDirection; shape.randomPositionAmount = randomizePosition; shape.position = position; shape.rotation = rotation; shape.scale = scale; }
void OnGUI() { List<