Changing light intensity with a slider

I’m using a gui slider to change the lights, but for some reason everything is just completely dark when I playtest it. It’s written in C#.

Here’s the code:

using UnityEngine;
using System.Collections;

public class lights_intensity_slider : MonoBehaviour {
	
    public float intensity = 1f;

    public Rect SliderLocation;

	public Light[] lights;
	
	private float[] orglightsintensity = {0f,0f,0f,0f};
	
	void start() {
		
		for(int i=0;i<lights.Length;i++) {
			
			orglightsintensity_=lights*.intensity;*_

* }*
* }*

void Update() {

* for (int i=0; i < lights.Length; i++) {*

lights.intensity = orglightsintensity * intensity;
* }*

}

void OnGUI () {

* intensity = GUI.HorizontalSlider(SliderLocation, intensity, 0f, 2f);*

}
}

Your “start” function will never execute, since there is no built-in function called that. You mean “Start”.

In the Lights segment you should assign size to 1. Then you will get Element 0 added to your Inspector. You should assign the light which you wanna test.

Can you please explain me how to us your script, cos i assigned your script to a Game Object. Only the slider moved, but nothing happened to the light which i assigned.

I have attached a reference pic of my workings. Hope someone will get something.