LightsModule

struct in UnityEngine

Switch to Manual

Description

访问 ParticleSystem 光源模块。

The Lights module allows you to attach real-time Lights to a percentage of your particles.

光源模块是一种简单而强大的模块,使粒子可以方便地将光投射到其环境上。光源可以从它们所附加到的粒子继承属性(如颜色和大小)。支持点光源和聚光灯,包括阴影投射和灯光遮罩。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Light myLight;

void Start() { ParticleSystem ps = GetComponent<ParticleSystem>(); var lights = ps.lights; lights.enabled = true; lights.ratio = 0.5f; lights.light = myLight; } }

Variables

alphaAffectsIntensity切换在计算最终光强度时,是否将粒子 Alpha 乘以光强度。
enabledEnable or disable the Lights module.
intensity定义一条曲线,以将自定义强度缩放应用于粒子光源。
intensityMultiplier强度乘数。
lightSelect what Light Prefab you want to base your particle lights on.
maxLights对此模块可以创建的光源数设置限制。
range定义一条曲线,以将自定义范围缩放应用于粒子光源。
rangeMultiplier范围乘数。
ratio选择将接收动态光源的粒子比例。
sizeAffectsRange切换是否将粒子大小乘以光源范围,以确定最终光源范围。
useParticleColor切换粒子光源是否将其颜色乘以粒子颜色。
useRandomDistribution基于 ParticleSystem.LightsModule.ratio 随机将光源分配给新粒子。