配置轨迹以生成法线和切线。借助此数据,场景光照可以通过法线贴图和 Unity 标准着色器或您自己的定制着色器来影响轨迹。
using UnityEngine; using System.Collections;
[RequireComponent(typeof(ParticleSystem))] public class ExampleClass : MonoBehaviour { private ParticleSystem ps;
void Start() { ps = GetComponent<ParticleSystem>();
var main = ps.main; main.startSize = 0.1f;
var trails = ps.trails; trails.enabled = true; trails.generateLightingData = true;
var psr = GetComponent<ParticleSystemRenderer>(); psr.trailMaterial = new Material(Shader.Find("Standard")); } }