A component to make Unity's Light component flicker by a sequence of alphabets. This way of implementing flickering lights is inspired by Valve, which is used in their games like Quake and Half-Life series.
(Click to show) Select from 12 presets, or type in custom patterns, and preview the changes in realtime.
![](Readme/Readme-Editor.gif)
- Download the full repository.
- You can try out the test scene under the
Test
folder to see how it works.
- Add
LightFlicker
to an existingLight
component. - Click on the
Preview Pattern
to see the flicker pattern in action in Edit Mode. A preview Animation Curve and a timeline cursor will help visualize the change of the light intensity in a graph. - Select the flicker pattern from a group for presets or type in a custom pattern.
- The pattern defines how the light intensity will change in sequence using alphabets a to z, from lowest (
a
being 0% brightness) to highest (z
being 200% brightness). - Define the
Normal Brightness
, the light intensity at 100% brightness, or when the flicker pattern reaches them
letter.
- Note that this will override the
Intensity
field on the originalLight
component.
- Define the
Pattern Duration
and toggle theLerp
option (linear interpolation, i.e. whether the light intensity will change smoothly or not). - Some public properties are exposed so settings can be changed by other scripts, see the section below.
Property Name | Type | Description |
---|---|---|
Pattern |
string |
The pattern of the Light component's intensity using alphabets between a to z , with a being 0%, m being 100%, and z being 200% intensity of the NormalBrightness . |
PresetPattern |
LightFlickerUtility.Preset (Custom type) |
Set the pattern from a selected collection of presets referenced from Valve's games. See the section below for the full list of available presets. |
NormalBrightness |
float |
The light intensity at 100% brightness. Note: This will override the Light component's intensensity value. |
Speed Settings
Property Name | Type | Description |
---|---|---|
PatternDuration |
float |
The duration for the pattern to iterate once. |
Lerp |
bool |
Whether the light intensity should change smoothly using linear interpolation (lerp). |
Here are all 15 presets available to quickly achieve flickering lights. You may add your own presets under the file Utility/LightFlickerUtility.cs
.
None
Preview | |
Preset Enum | LightFlickerUtility.Preset.None |
Actual Sequence | a |
Normal
Preview | |
Preset Enum | LightFlickerUtility.Preset.Normal |
Actual Sequence | m |
Double Brightness
Preview | |
Preset Enum | LightFlickerUtility.Preset.DoubleBrightness |
Actual Sequence | z |
Fluorescent Flicker
Preview | |
Preset Enum | LightFlickerUtility.Preset.FluorescentFlicker |
Actual Sequence | mmamammmmammamamaaamammma |
Slow Strobe
Preview | |
Preset Enum | LightFlickerUtility.Preset.SlowStrobe |
Actual Sequence | aaaaaaaazzzzzzzz |
Gentle Pulse
Preview | |
Preset Enum | LightFlickerUtility.Preset.GentlePulse |
Actual Sequence | jklmnopqrstuvwxyzyxwvutsrqponmlkj |
Slow Strong Pulse
Preview | |
Preset Enum | LightFlickerUtility.Preset.SlowStrongPulse |
Actual Sequence | abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba |
Slow Pulse Not Fade To Black
Preview | |
Preset Enum | LightFlickerUtility.Preset.SlowPulseNotFadeToBlack |
Actual Sequence | abcdefghijklmnopqrrqponmlkjihgfedcba |
Fast Strobe
Preview | |
Preset Enum | LightFlickerUtility.Preset.FastStrobe |
Actual Sequence | mamamamamama |
Underwater Light Mutation
Preview | |
Preset Enum | LightFlickerUtility.Preset.UnderwaterLightMutation |
Actual Sequence | mmnnmmnnnmmnn |
Candle (First Variety)
Preview | |
Preset Enum | LightFlickerUtility.Preset.Candle1 |
Actual Sequence | mmmmmaaaaammmmmaaaaaabcdefgabcdefg |
Candle (Second Variety)
Preview | |
Preset Enum | LightFlickerUtility.Preset.Candle2 |
Actual Sequence | mmmaaaabcdefgmmmmaaaammmaamm |
Candle (Third Variety)
Preview | |
Preset Enum | LightFlickerUtility.Preset.Candle3 |
Actual Sequence | mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa |
Flicker (First Variety)
Preview | |
Preset Enum | LightFlickerUtility.Preset.Flicker1 |
Actual Sequence | mmnmmommommnonmmonqnmmo |
Flicker (Second Variety)
Preview | |
Preset Enum | LightFlickerUtility.Preset.Flicker2 |
Actual Sequence | nmonqnmomnmomomnon |