Version: 2019.1

説明

Access the main Particle System settings.

The main module provides access to the general settings that are displayed above all of the other module settings in the Particle System's Inspector window.

Particle System modules do not need to be reassigned back to the system; they are interfaces and not independent objects.

// Create a Particle System
// Set a 5 second start delay for the system, and a 2 second lifetime for each particle
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { ParticleSystem ps = GetComponent<ParticleSystem>(); var main = ps.main;

main.startDelay = 5.0f; main.startLifetime = 2.0f; } }