unity-lighting-vfx
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUnity Lighting and Visual Effects
Unity 灯光与视觉效果
Lighting Modes
光照模式
Unity provides three light modes controlling how illumination is calculated.
Unity提供三种光照模式,用于控制光照的计算方式。
Realtime Lights
实时灯光
- Calculate lighting every frame at runtime
- Allow dynamic changes to intensity, color, position
- Cast shadows up to Shadow Distance
- Contribute only direct lighting by default (no bounced light)
- Higher runtime cost, especially in complex scenes or low-end hardware
- Best for: dynamic objects, flickering effects, moving light sources
- 运行时每帧计算光照
- 允许动态调整强度、颜色、位置
- 可投射阴影,阴影范围受Shadow Distance限制
- 默认仅贡献直接光照(无反弹光)
- 运行时成本较高,尤其是在复杂场景或低端硬件中
- 最佳适用场景:动态物体、闪烁效果、移动光源
Baked Lights
烘焙灯光
- Calculations performed in the Unity Editor and saved as lighting data to disk
- At runtime, Unity loads pre-computed data instead of calculating dynamically
- Bake both direct and indirect lighting into lightmaps
- Store information in Light Probes for moving objects
- Cannot modify light properties at runtime; do not illuminate dynamic GameObjects
- No specular contributions
- Best for: static scenery, complex indirect lighting, performance-critical scenarios
- 在Unity编辑器中完成计算,并将光照数据保存到磁盘
- 运行时Unity加载预计算数据,而非动态计算
- 将直接光照和间接光照烘焙到光照贴图中
- 为移动物体存储光照探针信息
- 运行时无法修改灯光属性;不会照亮动态GameObject
- 无高光贡献
- 最佳适用场景:静态场景、复杂间接光照、性能优先的场景
Mixed Lights
混合灯光
- Combine baked indirect lighting with real-time direct lighting
- Behavior depends on the Lighting Mode setting in the Lighting window
- Cast real-time shadows (not baked soft shadows)
- Can change properties at runtime (affects real-time component only)
- Always more expensive than fully baked lighting
- Best for: dynamic shadows with baked background lighting
Important: All baked/mixed modes require Baked Global Illumination enabled. Without it, Mixed and Baked lights behave as Realtime.
- 结合烘焙间接光照与实时直接光照
- 行为取决于Lighting窗口中的Lighting Mode设置
- 投射实时阴影(非烘焙软阴影)
- 运行时可修改属性(仅影响实时部分)
- 成本始终高于完全烘焙的光照
- 最佳适用场景:需要动态阴影且背景光照为烘焙的场景
重要提示:所有烘焙/混合模式都需要启用Baked Global Illumination。未启用时,混合灯光和烘焙灯光会自动切换为实时灯光模式。
Light Types
灯光类型
Directional Light
方向光
- Located infinitely far away, emits light in one direction
- Parallel rays, no distance-based intensity falloff
- Simulates sun/moon; every new scene includes one by default
- Links to procedural sky system; rotate to create time-of-day effects
- 位于无限远处,向单一方向发射光线
- 光线平行,强度不随距离衰减
- 模拟太阳/月亮;新建场景默认包含一个方向光
- 与程序化天空系统关联;旋转可实现昼夜变化效果
Point Light
点光源
- Located at a point, emits in all directions equally
- Intensity follows inverse square law (diminishes with distance squared)
- Use for lamps, explosions, local illumination
- 位于某一点,向所有方向均匀发射光线
- 强度遵循平方反比定律(随距离平方衰减)
- 适用于灯具、爆炸效果、局部照明
Spot Light
聚光灯
- Located at a point, emits in a cone shape
- Adjustable cone angle; light diminishes at edges (penumbra)
- Wider angles create larger fade areas
- Use for flashlights, headlights, searchlights
- 位于某一点,以锥形范围发射光线
- 可调整锥角;光线在边缘衰减(半影区)
- 角度越宽,衰减区域越大
- 适用于手电筒、车头灯、探照灯
Area Light
面光源
- Defined by a rectangle or disc; emits uniformly across surface
- Follows inverse square law; produces soft, subtle shading
- Bake-only -- not available at runtime
- Use for street lights, realistic interior lighting
- 由矩形或圆形定义,从表面均匀发射光线
- 遵循平方反比定律;产生柔和、细腻的阴影
- 仅支持烘焙——运行时不可用
- 适用于路灯、真实室内照明
Global Illumination
全局光照
Global illumination (GI) simulates how light bounces between surfaces, producing realistic indirect lighting.
全局光照(GI)模拟光线在表面间的反弹,生成真实的间接光照效果。
Baked GI
烘焙GI
- Pre-computes indirect lighting into lightmaps using the Progressive Lightmapper (CPU or GPU)
- Results stored in lightmap textures and Light Probes
- Configure in the Lighting window under Bake settings
- GPU Progressive Lightmapper offers faster bake times with configurable tile sizes
- 使用Progressive Lightmapper(CPU或GPU)将间接光照预计算到光照贴图中
- 结果存储在光照贴图纹理和光照探针中
- 在Lighting窗口的Bake设置中配置
- GPU Progressive Lightmapper支持更快的烘焙速度,且可配置 tile 大小
Environment Lighting
环境光照
Three ambient light sources configured in the Lighting window Environment tab:
- Skybox: Uses skybox material colors for ambient light from different angles
- Gradient: Separate sky, horizon, and ground colors with smooth blending
- Color: Uniform ambient light across the scene
Intensity Multiplier (0-8, default 1) controls ambient brightness.
在Lighting窗口的Environment标签中配置三种环境光源:
- Skybox:使用天空盒材质颜色,从不同角度提供环境光
- Gradient:分别设置天空、地平线和地面颜色,实现平滑过渡
- Color:为场景提供统一的环境光
Intensity Multiplier(范围0-8,默认1)控制环境光亮度。
Environment Reflections
环境反射
- Source: Skybox or custom Cubemap/RenderTexture
- Configurable resolution, compression, intensity multiplier
- Bounces setting controls reflection evaluation iterations between objects
- 来源:Skybox或自定义Cubemap/RenderTexture
- 可配置分辨率、压缩方式、强度乘数
- Bounces设置控制物体间反射计算的迭代次数
Light Probes and Adaptive Probe Volumes
光照探针与自适应探针体积
Light Probes
光照探针
- Capture lighting information in empty space throughout a scene
- At runtime, indirect lighting for dynamic GameObjects is approximated using nearest probes
- Provide indirect bounced light for moving objects and LOD system support
- Must be manually placed using Light Probe Groups
- Store baked lighting information; work with both direct and indirect lighting
- 捕获场景中空旷区域的光照信息
- 运行时,动态GameObject的间接光照通过最近的探针进行近似计算
- 为移动物体和LOD系统提供间接反弹光支持
- 需使用Light Probe Groups手动放置
- 存储烘焙光照信息;支持直接光照和间接光照
Adaptive Probe Volumes (APV)
自适应探针体积(APV)
APV is the modern replacement for manual Light Probe placement in URP:
- Automated probe placement -- eliminates manual Light Probe Group positioning
- Per-pixel lighting -- superior quality compared to per-object approaches
- Scene baking -- bake multiple scenes together using Baking Sets
- Runtime adjustments -- Lighting Scenarios and sky occlusion for dynamic changes
- Large-world support -- streaming data for expansive open-world environments
- Data flexibility -- loading from AssetBundles or Addressables
- Configurable probe density and volume size with visualization tools
APV是URP中手动放置光照探针的现代化替代方案:
- 自动探针放置——无需手动定位Light Probe Group
- 逐像素光照——相比逐物体方案,质量更优
- 场景烘焙——使用Baking Sets可同时烘焙多个场景
- 运行时调整——支持Lighting Scenarios和天空遮挡,实现动态变化
- 大世界支持——为大型开放世界环境提供数据流
- 数据灵活性——可从AssetBundles或Addressables加载
- 可配置探针密度和体积大小,并提供可视化工具
Reflection Probes
反射探针
Capture a spherical view of surroundings as a cubemap for reflective materials.
捕获周围环境的球形视图,保存为立方体贴图,用于反射材质。
Types
类型
| Type | Description |
|---|---|
| Baked | Captures static GameObjects only; best performance |
| Custom | Allows dynamic object capture with custom textures |
| Realtime | Updates during gameplay; configurable refresh mode |
| 类型 | 描述 |
|---|---|
| Baked | 仅捕获静态GameObject;性能最佳 |
| Custom | 允许使用自定义纹理捕获动态物体 |
| Realtime | 游戏运行时更新;可配置刷新模式 |
Key Properties
关键属性
- Importance: Rendering priority when multiple probes overlap
- Intensity: Texture brightness in shader calculations
- Box Projection: Enables projection mapping for interiors (requires URP config)
- Box Size/Offset: World-space bounding box for reflection contribution
- Blend Distance: Blending distance for deferred probes
- Importance:多个探针重叠时的渲染优先级
- Intensity:着色器计算中的纹理亮度
- Box Projection:启用室内投影映射(需URP配置)
- Box Size/Offset:反射贡献的世界空间边界框
- Blend Distance:延迟探针的混合距离
Realtime Options
实时选项
- Refresh Mode: On Awake, Every Frame, or Via Scripting
- Time Slicing: All Faces At Once, Individual Faces, No Time Slicing
- Refresh Mode:唤醒时刷新、每帧刷新或通过脚本刷新
- Time Slicing:一次性渲染所有面、逐个渲染面、不使用时间切片
Particle System vs VFX Graph
Particle System vs VFX Graph
| Feature | Particle System | VFX Graph |
|---|---|---|
| Simulation | CPU-based | GPU-based |
| Particle count | Thousands | Millions |
| Render pipeline | All pipelines | URP/HDRP only |
| Authoring | Inspector modules | Node-based graph editor |
| Physics | Built-in collision | Custom collision blocks |
| Scripting | Full C# API | Event-based C# API |
| Sub-emitters | Native support | GPU Event contexts |
| Best for | Small/medium effects, mobile | Large-scale effects, high-end |
Decision Guide:
- Use Particle System for mobile targets, simple effects, when you need full CPU-side scripting control, or when targeting the Built-in Render Pipeline
- Use VFX Graph for massive particle counts, GPU-driven simulations, complex node-based authoring, or high-end platforms with URP/HDRP
| 特性 | Particle System | VFX Graph |
|---|---|---|
| 模拟方式 | 基于CPU | 基于GPU |
| 粒子数量 | 数千级 | 数百万级 |
| 渲染管线 | 支持所有管线 | 仅支持URP/HDRP |
| 创建方式 | 检查器模块 | 基于节点的图形编辑器 |
| 物理系统 | 内置碰撞 | 自定义碰撞模块 |
| 脚本控制 | 完整C# API | 基于事件的C# API |
| 子发射器 | 原生支持 | GPU Event上下文 |
| 最佳场景 | 中小型效果、移动端 | 大规模效果、高端平台 |
选择指南:
- 当目标为移动端、需要简单效果、需要完整CPU端脚本控制,或使用Built-in Render Pipeline时,选择Particle System
- 当需要海量粒子、GPU驱动模拟、复杂节点式创建,或使用URP/HDRP的高端平台时,选择VFX Graph
Particle System Modules
Particle System模块
| Module | Purpose |
|---|---|
| Main | Initial state: lifetime, speed, size, gravity, simulation space |
| Emission | Rate and timing of particle spawns |
| Shape | Volume/surface for emission and start velocity direction |
| Velocity over Lifetime | Modify movement over particle age |
| Noise | Turbulence for organic, chaotic motion |
| Limit Velocity over Lifetime | Natural deceleration |
| Force over Lifetime | Simulated physics forces |
| Inherit Velocity | Sub-emitter particles match parent velocity |
| Lifetime by Emitter Speed | Adjust lifespan based on emitter velocity |
| Color over Lifetime / by Speed | Color changes based on age or velocity |
| Size over Lifetime / by Speed | Dimension changes based on time or speed |
| Rotation over Lifetime / by Speed | Orientation changes |
| Collision | Particle collisions with scene geometry |
| Triggers | Designate particles as collision triggers |
| Sub Emitters | Particles that emit other particles |
| Texture Sheet Animation | Texture grid animation frames |
| Trails | Motion trail rendering |
| Lights | Real-time lights on particles |
| External Forces | Wind zones and force fields |
| Renderer | Image/mesh transform, shading, overdraw |
| Custom Data | Attach custom data to particles |
| 模块 | 用途 |
|---|---|
| Main | 初始状态设置:生命周期、速度、大小、重力、模拟空间 |
| Emission | 粒子生成的速率和时间控制 |
| Shape | 粒子发射的体积/表面及初始速度方向 |
| Velocity over Lifetime | 随粒子生命周期修改运动状态 |
| Noise | 为粒子添加湍流,实现自然、混乱的运动 |
| Limit Velocity over Lifetime | 模拟自然减速效果 |
| Force over Lifetime | 模拟物理作用力 |
| Inherit Velocity | 子发射器粒子继承父物体速度 |
| Lifetime by Emitter Speed | 根据发射器速度调整粒子生命周期 |
| Color over Lifetime / by Speed | 根据粒子年龄或速度改变颜色 |
| Size over Lifetime / by Speed | 根据时间或速度改变粒子尺寸 |
| Rotation over Lifetime / by Speed | 改变粒子朝向 |
| Collision | 粒子与场景几何体的碰撞 |
| Triggers | 将粒子标记为碰撞触发器 |
| Sub Emitters | 可发射其他粒子的粒子 |
| Texture Sheet Animation | 纹理网格动画帧 |
| Trails | 运动轨迹渲染 |
| Lights | 粒子上的实时灯光 |
| External Forces | 风区和力场 |
| Renderer | 图像/网格变换、着色、过绘制 |
| Custom Data | 为粒子附加自定义数据 |
VFX Graph Basics
VFX Graph基础
Systems
系统
- Spawn System: Single Spawn Context managing emission
- Particle System: Initialize -> Update -> Output succession
- Mesh Output System: Single Mesh Output Context
- Spawn System:管理粒子发射的单个Spawn Context
- Particle System:初始化 -> 更新 -> 输出的流程
- Mesh Output System:单个Mesh Output Context
Contexts
上下文
- Spawn: Executes each frame to calculate spawn amounts. States: Running, Idle, Waiting. Configurable loop duration, count, and delays
- Initialize: Runs at particle birth, sets initial state. Processes Blocks for newly spawned particles. Configurable bounds and capacity
- Update: Per-frame for all living particles. Automatic: position integration, rotation integration, aging, reaping
- Output: Renders particles (Quad, Mesh, etc.). No output ports. Customizable rendering blocks
- Spawn:每帧执行以计算粒子生成数量。状态:Running、Idle、Waiting。可配置循环时长、数量和延迟
- Initialize:粒子生成时运行,设置初始状态。处理新生成粒子的Blocks。可配置边界和容量
- Update:每帧对所有存活粒子执行。自动处理:位置整合、旋转整合、老化、销毁
- Output:渲染粒子(Quad、Mesh等)。无输出端口。可自定义渲染Blocks
Graph Elements
图形元素
- Blocks: Stackable nodes within Contexts; each handles one operation; top-to-bottom execution
- Operators: Low-level property workflow nodes connecting to Block/Context ports
- Properties: Connectable via property workflow
- Settings: Non-connectable editable values per Context
- Blocks:上下文内可堆叠的节点;每个节点处理一项操作;按从上到下顺序执行
- Operators:连接Block/Context端口的底层属性工作流节点
- Properties:可通过属性工作流连接
- Settings:每个上下文的不可连接可编辑值
GPU Events
GPU Events
Experimental feature where GPU computes events (vs CPU for normal events). Cannot be customized with Blocks.
实验性功能,由GPU计算事件(常规事件由CPU计算)。无法用Blocks自定义。
Common Patterns (C#)
常见模式(C#)
Create and Configure a Light
创建并配置灯光
csharp
using UnityEngine;
public class LightSetup : MonoBehaviour
{
void Start()
{
GameObject lightObj = new GameObject("Dynamic Light");
Light light = lightObj.AddComponent<Light>();
light.type = LightType.Point;
light.color = Color.yellow;
light.intensity = 2.0f;
light.range = 15f;
light.shadows = LightShadows.Soft;
light.shadowResolution = UnityEngine.Rendering.LightShadowResolution.Medium;
}
}csharp
using UnityEngine;
public class LightSetup : MonoBehaviour
{
void Start()
{
GameObject lightObj = new GameObject("Dynamic Light");
Light light = lightObj.AddComponent<Light>();
light.type = LightType.Point;
light.color = Color.yellow;
light.intensity = 2.0f;
light.range = 15f;
light.shadows = LightShadows.Soft;
light.shadowResolution = UnityEngine.Rendering.LightShadowResolution.Medium;
}
}Create a Realtime Reflection Probe
创建实时反射探针
csharp
using UnityEngine;
using UnityEngine.Rendering;
public class ProbeSetup : MonoBehaviour
{
void Start()
{
GameObject probeObj = new GameObject("Realtime Reflection Probe");
ReflectionProbe probe = probeObj.AddComponent<ReflectionProbe>();
probe.size = new Vector3(10, 10, 10);
probe.mode = ReflectionProbeMode.Realtime;
probe.refreshMode = ReflectionProbeRefreshMode.EveryFrame;
probe.resolution = 256;
probe.hdr = true;
}
}csharp
using UnityEngine;
using UnityEngine.Rendering;
public class ProbeSetup : MonoBehaviour
{
void Start()
{
GameObject probeObj = new GameObject("Realtime Reflection Probe");
ReflectionProbe probe = probeObj.AddComponent<ReflectionProbe>();
probe.size = new Vector3(10, 10, 10);
probe.mode = ReflectionProbeMode.Realtime;
probe.refreshMode = ReflectionProbeRefreshMode.EveryFrame;
probe.resolution = 256;
probe.hdr = true;
}
}Control Particle System at Runtime
运行时控制Particle System
csharp
using UnityEngine;
public class ParticleController : MonoBehaviour
{
ParticleSystem ps;
void Start()
{
ps = GetComponent<ParticleSystem>();
// Modify emission rate -- cache module in local variable first
var emission = ps.emission;
emission.rateOverTimeMultiplier = 50f;
// Modify main module
var main = ps.main;
main.startLifetime = 3f;
main.startSpeed = 5f;
main.simulationSpace = ParticleSystemSimulationSpace.World;
}
void OnTriggerEnter(Collider other)
{
// Burst emit particles
ps.Emit(100);
}
void OnDisable()
{
ps.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
}
}csharp
using UnityEngine;
public class ParticleController : MonoBehaviour
{
ParticleSystem ps;
void Start()
{
ps = GetComponent<ParticleSystem>();
// 修改发射速率——先将模块缓存到局部变量
var emission = ps.emission;
emission.rateOverTimeMultiplier = 50f;
// 修改主模块
var main = ps.main;
main.startLifetime = 3f;
main.startSpeed = 5f;
main.simulationSpace = ParticleSystemSimulationSpace.World;
}
void OnTriggerEnter(Collider other)
{
// 爆发式生成粒子
ps.Emit(100);
}
void OnDisable()
{
ps.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
}
}VFX Graph Runtime Control
VFX Graph运行时控制
csharp
using UnityEngine;
using UnityEngine.VFX;
public class VFXController : MonoBehaviour
{
VisualEffect vfx;
VFXEventAttribute eventAttr;
void Start()
{
vfx = GetComponent<VisualEffect>();
eventAttr = vfx.CreateVFXEventAttribute();
// Set exposed properties
vfx.SetFloat("SpawnRate", 100f);
vfx.SetVector3("Direction", Vector3.up);
vfx.playRate = 1.5f;
}
void OnTriggerEnter(Collider other)
{
// Send custom event with attributes
eventAttr.SetVector3("position", other.transform.position);
vfx.SendEvent("OnHit", eventAttr);
}
public void StopEffect()
{
vfx.Stop();
}
}csharp
using UnityEngine;
using UnityEngine.VFX;
public class VFXController : MonoBehaviour
{
VisualEffect vfx;
VFXEventAttribute eventAttr;
void Start()
{
vfx = GetComponent<VisualEffect>();
eventAttr = vfx.CreateVFXEventAttribute();
// 设置暴露属性
vfx.SetFloat("SpawnRate", 100f);
vfx.SetVector3("Direction", Vector3.up);
vfx.playRate = 1.5f;
}
void OnTriggerEnter(Collider other)
{
// 发送带属性的自定义事件
eventAttr.SetVector3("position", other.transform.position);
vfx.SendEvent("OnHit", eventAttr);
}
public void StopEffect()
{
vfx.Stop();
}
}Refresh Reflection Probe on Demand
按需刷新反射探针
csharp
using UnityEngine;
public class ProbeRefresher : MonoBehaviour
{
ReflectionProbe probe;
void Start()
{
probe = GetComponent<ReflectionProbe>();
probe.refreshMode = UnityEngine.Rendering.ReflectionProbeRefreshMode.ViaScripting;
}
public void RefreshReflections()
{
probe.RenderProbe();
}
public bool IsReady()
{
return probe.IsFinishedRendering(probe.RenderProbe());
}
}csharp
using UnityEngine;
public class ProbeRefresher : MonoBehaviour
{
ReflectionProbe probe;
void Start()
{
probe = GetComponent<ReflectionProbe>();
probe.refreshMode = UnityEngine.Rendering.ReflectionProbeRefreshMode.ViaScripting;
}
public void RefreshReflections()
{
probe.RenderProbe();
}
public bool IsReady()
{
return probe.IsFinishedRendering(probe.RenderProbe());
}
}Anti-Patterns
反模式
Lighting Anti-Patterns
光照反模式
- Too many Realtime lights: Each realtime light adds per-frame cost. Use Baked or Mixed for static lights
- Forgetting to enable Baked Global Illumination: Mixed/Baked lights silently fall back to Realtime without it
- Overlapping Reflection Probes without Importance values: Causes flickering; always set Importance to establish priority
- Using Area Lights expecting runtime behavior: Area lights are bake-only; they produce no light at runtime
- Ignoring Indirect Multiplier: Leaving at default can cause over-bright or too-dark bounced light; tune per light
- Not setting Shadow Bias correctly: Too low causes self-shadowing artifacts (shadow acne); too high causes peter-panning (shadows detach from objects)
- Manual Light Probe placement in large scenes: Use Adaptive Probe Volumes (APV) in URP instead for automated, per-pixel quality
- 过多实时灯光:每个实时灯光都会增加每帧成本。静态灯光应使用烘焙或混合模式
- 忘记启用Baked Global Illumination:未启用时,混合/烘焙灯光会自动切换为实时模式
- 重叠反射探针未设置Importance值:会导致闪烁;始终需设置Importance来确定优先级
- 期望面光源在运行时生效:面光源仅支持烘焙;运行时不会产生光照
- 忽略Indirect Multiplier:默认值可能导致反弹光过亮或过暗;需针对每个灯光调整
- Shadow Bias设置不当:值过低会导致自阴影 artifacts(阴影 acne);值过高会导致阴影脱离物体(peter-panning)
- 在大型场景中手动放置光照探针:在URP中应使用自适应探针体积(APV),实现自动放置和逐像素质量
Particle System Anti-Patterns
Particle System反模式
- Not caching module references: Each property access on a module struct immediately writes to native code; cache the module variable
- Using World simulation space for attached effects: Particles drift away from moving parents; use Local space for attached FX
- Excessive particle counts on CPU: Particle System is CPU-bound; for >10K particles, consider VFX Graph
- Forgetting to Stop/Clear: Leaked particle systems consume CPU even when invisible
- 未缓存模块引用:每次访问模块结构体属性都会立即写入原生代码;需缓存模块变量
- 对附着效果使用World模拟空间:粒子会从移动的父物体漂移;附着效果应使用Local空间
- CPU上粒子数量过多:Particle System基于CPU;粒子数量超过10K时,考虑使用VFX Graph
- 忘记停止/清除粒子系统:泄漏的粒子系统即使不可见也会消耗CPU
VFX Graph Anti-Patterns
VFX Graph反模式
- Using VFX Graph for simple effects on mobile: GPU overhead and URP/HDRP requirement make it overkill for simple mobile effects
- Not setting Capacity in Initialize: Default capacity may allocate too much or too little GPU memory
- Ignoring Bounds: Incorrect bounds cause effects to be culled when visible; always configure bounds in Initialize context
- Sending events every frame without throttling: SendEvent has CPU-GPU sync cost; batch or throttle event dispatch
- 在移动端使用VFX Graph实现简单效果:GPU开销和URP/HDRP要求使其在移动端简单效果场景中过于冗余
- 未在Initialize中设置Capacity:默认容量可能分配过多或过少GPU内存
- 忽略Bounds:错误的Bounds会导致可见效果被剔除;始终需在Initialize上下文中配置Bounds
- 无限制地每帧发送事件:SendEvent存在CPU-GPU同步成本;需批量处理或限制事件发送频率
Key API Quick Reference
关键API速查
Light (UnityEngine.Light)
Light(UnityEngine.Light)
| Member | Type | Description |
|---|---|---|
| Property | LightType (Directional, Point, Spot, Area) |
| Property | Emitted light color |
| Property | Brightness multiplier |
| Property | Max distance (Point/Spot) |
| Property | Outer/inner cone angles |
| Property | LightShadows (None, Hard, Soft) |
| Property | Shadow map quality |
| Property | Shadow artifact reduction |
| Property | GI bounce strength |
| Property | Projected texture mask |
| Property | Layer-based filtering |
| Property | CCT in Kelvin |
| Property | Baking configuration |
| Property | Last bake contribution details |
| Method | Execute GPU commands at specified points |
| 成员 | 类型 | 描述 |
|---|---|---|
| 属性 | LightType(Directional、Point、Spot、Area) |
| 属性 | 发射光颜色 |
| 属性 | 亮度乘数 |
| 属性 | 最大距离(点光源/聚光灯) |
| 属性 | 外/内锥角 |
| 属性 | LightShadows(None、Hard、Soft) |
| 属性 | 阴影贴图质量 |
| 属性 | 减少阴影 artifacts |
| 属性 | GI反弹强度 |
| 属性 | 投影纹理遮罩 |
| 属性 | 基于层的过滤 |
| 属性 | 色温(开尔文) |
| 属性 | 烘焙配置 |
| 属性 | 上次烘焙贡献详情 |
| 方法 | 在指定阶段执行GPU命令 |
ParticleSystem (UnityEngine.ParticleSystem)
ParticleSystem(UnityEngine.ParticleSystem)
| Member | Type | Description |
|---|---|---|
| Property | Module access structs |
| Property | Current active particles |
| Property | Playback state |
| Method | Playback control |
| Method | Immediate particle spawn |
| Method | Fast-forward simulation |
| Method | Direct particle data access |
| Method | Remove all particles |
| Method | Activate sub-emitters |
| 成员 | 类型 | 描述 |
|---|---|---|
| 属性 | 模块访问结构体 |
| 属性 | 当前活跃粒子数 |
| 属性 | 播放状态 |
| 方法 | 播放控制 |
| 方法 | 立即生成粒子 |
| 方法 | 快进模拟 |
| 方法 | 直接访问粒子数据 |
| 方法 | 移除所有粒子 |
| 方法 | 激活子发射器 |
VisualEffect (UnityEngine.VFX.VisualEffect)
VisualEffect(UnityEngine.VFX.VisualEffect)
| Member | Type | Description |
|---|---|---|
| Property | Assign/change effect graph |
| Property | Simulation speed |
| Property | Active particle count |
| Method | Playback control |
| Method | Trigger graph events |
| Method | Create event payload |
| Method | Set exposed properties |
| Method | Read exposed properties |
| Method | Check property existence |
| Method | Restore original values |
| 成员 | 类型 | 描述 |
|---|---|---|
| 属性 | 分配/更换效果图形 |
| 属性 | 模拟速度 |
| 属性 | 活跃粒子数 |
| 方法 | 播放控制 |
| 方法 | 触发图形事件 |
| 方法 | 创建事件负载 |
| 方法 | 设置暴露属性 |
| 方法 | 读取暴露属性 |
| 方法 | 检查属性是否存在 |
| 方法 | 恢复原始值 |
ReflectionProbe (UnityEngine.ReflectionProbe)
ReflectionProbe(UnityEngine.ReflectionProbe)
| Member | Type | Description |
|---|---|---|
| Property | Baked/Custom/Realtime |
| Property | Bounding box config |
| Property | Brightness and priority |
| Property | Enable box projection |
| Property | Realtime update config |
| Method | Force cubemap refresh |
| Method | Check time-sliced completion |
| Method | Blend two cubemaps |
| 成员 | 类型 | 描述 |
|---|---|---|
| 属性 | Baked/Custom/Realtime |
| 属性 | 边界框配置 |
| 属性 | 亮度和优先级 |
| 属性 | 启用盒式投影 |
| 属性 | 实时更新配置 |
| 方法 | 强制刷新立方体贴图 |
| 方法 | 检查时间切片渲染是否完成 |
| 方法 | 混合两个立方体贴图 |
Related Skills
相关技能
- -- Render pipelines (URP/HDRP/Built-in), shaders, materials, cameras
unity-graphics - -- 2D lighting (URP 2D Renderer), sprite rendering
unity-2d - -- Platform-specific lighting quality tiers, mobile optimization
unity-platforms
- -- 渲染管线(URP/HDRP/Built-in)、着色器、材质、相机
unity-graphics - -- 2D光照(URP 2D Renderer)、精灵渲染
unity-2d - -- 平台特定光照质量层级、移动端优化
unity-platforms