Version: 2021.1
Halo
Flare

Lens Flare

Lens Flares simulate the effect of lights refracting inside a camera lens. You can use them to represent bright lights or, more subtly, to add a bit more atmosphere to your Scene.

The easiest way to set up a lens flare is to assign a Flare Asset to the Flare property of a Light. If you do this, Unity automatically tracks the position and direction of the Light. To get more precise control, use this component.

To manually create a lens llare:

  1. Create a new GameObject (menu bar: GameObject > Create Empty).
  2. In the Inspector, click Add Component > Effects > Lens Flare.
  3. Assign a Flare Asset to the Flare property.

If you want a Camera to see lens flares, attach a Flare Layer component to the Camera’s GameObject.

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.

Enable the Effect toggle to view lens flares in the Scene view
Enable the Effect toggle to view lens flares in the Scene view

Propiedades

Propiedad: Función:
Flare The Flare to render. It is this Asset, and not the Lens Flare component, that controls most of the lens flare’s appearance. To customize the lens flare’s appearance, open the assigned Flare Asset in the Inspector. Here, you can view and edit any of the Flare’s properties. For information on what each property controls, see the Flare documentation. Unity includes pre-configured Flares for you to use in the Standard Assets package.
Color The color to tint the Flare to. You can use this to make the lens flare better fit the Scene’s mood.
Brightness The size and brightness the lens flare appears.
Fade Speed The speed at which Unity fades the lens flare in and out.
Ignore Layers A mask that determins which Layers can see the lens flare.
Directional Indicates whether Unity orients the Flare along the positive z-axis of the GameObject. It appears as if it was infinitely far away, and does not track the GameObject’s position, only the direction of its z-axis.

Detalles

  • If you use a very bright lens flare, make sure its direction fits with your Scene’s primary light source.
  • To design your own Flares, create a Flare Asset. To do this, click Assets > Create > Lens Flare.
  • Colliders block lens flares. A Collider between the Flare GameObject and the Camera hides the lens flare, even if the Collider does not have a Mesh Renderer. If the Collider is marked as Trigger, it only blocks the lens flare if Physics.queriesHitTriggers is true.
Halo
Flare