配置轨迹以生成法线和切线。通过这些数据,场景灯光可以通过法线贴图和 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")); } }