- Home /
Changing radius/diameter of spotlight
How to do? There is no area range option for me, but the forums say to find it in the light component, which there is none.
Comment
Answer by iagoccampos · Apr 25, 2015 at 08:55 PM
using UnityEngine;
using System.Collections;
public class ChangeLight : MonoBehaviour {
private Light light;
void Awake()
{
light = GetComponent<Light>();
light.range = 10;
light.spotAngle = 30;
}
}
Are you trying to do it?
You mean , how to change the "area range" value in the inspector? There is no "area range", there is a areaSize but it can't be changed in inspector, only via script.
You can change nearly any variable on the spotlight Light component just by dragging the slider/adjusting the value on the component. Can you state specifically what you're trying to do? Check my answer for adjusting values within the editor via script using public variables.
Answer by Addyarb · Apr 25, 2015 at 08:57 PM
Attach something like this to the gameObject that has the spotlight attached.
public float intensity;
public float spotAngle;
public float range;
public Light myLight;
void Start()
{
myLight = GetComponent<Light>();
myLight.spotAngle = spotAngle;
myLight.range = range;
myLight.intensity = 7;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613194043im_/https://answers.unity.com/themes/thub/images/avi.jpg)