skip to Main Content

Scripting Support (C#)

Accessing properties

All properties shown in the inspector are accessible through the volumetric light component.

First you need to get a reference to the main script which can be done easily using:

using VolumetricLights;


VolumetricLight vl = lightGameObject.GetComponent<VolumetricLight>;

(where lightGameObject is the gameobject of the light)

Then, you can set any property like density or wind speed/direction:

vl.density = 0.2f;

vl.windDirection = Vector3.right;


Call vl.UpdateMaterialProperties() to issue a refresh after setting the new values.

Creating volumetric lights at runtime

Use this code to create a new volumetric light using code:

VolumetricLight vl  = lightGameObject.AddComponent<VolumetricLight>();
Back To Top