Adjust 2d light intensity

Save this to your custom actions folder.

The action requires a 2d light (this won't work with 3d lights). To learn more about Unity's new 2d lighting system, see here:

https://docs.unity3d.com/Packages/com.unity.render-pipelines.lightweight@6.7/manual/2DLightProperties.html

You also must provide a float to set the intensity. You can set the intensity to 0 to turn the light off.

This script can probably be extended to cover adjusting all the options in a 2d light.

NOTE: When copying the script, it's essential you copy the following line:

using UnityEngine.Experimental.Rendering.Universal;

using UnityEngine; using System; using UnityEngine.Experimental.Rendering.Universal; using UnityEditor; /* By Meffy1122 * Custom action to * Change 2d light intensity. */  namespace AC   { [System.Serializable] public class ChangeLightIntensity: Action {         // Declare variables here public float intensity; public Light2D light; public float intensityField; public ChangeLightIntensity {             this.isDisplayed = true; category = ActionCategory.Custom; title = "Change light intensity"; description = "Changes light intensity"; }         override public float Run {             light.intensity = intensityField; return 0f; }  # if UNITY_EDITOR public override void ShowGUI {           light = (Light2D)EditorGUILayout.ObjectField("Light to affect:", light, typeof(Light2D), true); intensityField = (float)EditorGUILayout.FloatField("New light intensity:", intensityField); AfterRunningOption; }  # endif    //end the action }  }
 * 1) if UNITY_EDITOR
 * 1) endif