Version: 2023.2
Flare asset
Flare Layer component

Lens Flare component

A Lens Flare component displays a lens flare that is configured by a Flare asset.

You can display a Flare asset with a Light component. If you do this, Unity automatically tracks the position and direction of the Light and uses those values to configure the appearance of the lens flare.

Use this component instead to configure the values of the lens flare yourself, which gives you more precise control.

Note: This workflow is compatible only with the Built-in Render Pipeline. For similar functionality in other render pipelines, see Lens flares and halos.

Using a Lens Flare component

  1. 创建一个新的__游戏对象__(菜单栏:__GameObject > Create Empty__)。
  2. 在 Inspector 中单击 Add Component > Effects > Lens Flare
  3. Flare 属性指定一个光晕资源
  4. If you want a Camera to see lens flares, attach a Flare Layer component to the Camera’s GameObject.
  5. To see the lens flare effect in the Scene View, enable the Effect toggle in the Scene View toolbar and, in the drop-down, enable Flares.
启用效果开关以便在 Scene 视图中查看镜头光晕
启用效果开关以便在 Scene 视图中查看镜头光晕

属性

属性: 功能:
Flare The Flare asset to render.

Note: The other properties in the Lens Flare Inspector are stored in this Flare asset. They are not stored in the Lens Flare component.
Color 要将光晕着色成的颜色。可用于使镜头光晕更好地适应场景的氛围。
Brightness The size and brightness the lens flare appears. If you use a very bright lens flare, make sure its direction fits with your Scene’s primary light source. Can only affect properties that Flare has enabled.
Fade Speed Unity 淡入和淡出镜头光晕的速度。
Ignore Layers 一个确定哪些图层可以看到镜头光晕的遮罩。
Directional 指示 Unity 是否使光晕的方向沿游戏对象的正 z 轴。光晕看起来好像是无限远,不会跟踪游戏对象的位置,只跟踪 z 轴的方向。

LensFlare

Flare asset
Flare Layer component