How to copy all propeties of a light

Hi all, I’m making a simple script to basically copy the properties of one light on to all others .
While i could do

public Light baseLight ; 
public Light[] LU ;
void LightChange()
	{	foreach (Light Lighter in LU){
	
Lighter.area = baseLight.area ;
// for each property 
print(Lighter.name);
			//.	
	}

For each property, I want to know if theirs an easy way to copy every property of a light .

You seem to have had some formatting issues, here’s a reformatted version of how I think it should look:

`
public Light baseLight; 
public Light[] LU; 

void LightChange() 
{	
      foreach (Light Lighter in LU)
      { 
            Lighter.area = baseLight.area; // for each property 
            print(Lighter.name); //.	 
      }
}
`

You have two options:

  1. List each of the properties manually, from Unity - Scripting API: Light like so:
`

foreach (Light lighter in LU)
{ 
      lighter.type = baseLight.type;
      lighter.color = baseLight.color;
      lighter.intensity = baseLight.intensity;
      ...

      // Do not add code to copy positions in 3d space, or anything else that you wish not to copy
}
`

or you can just set all of them to be equal to baseLight (but this will also sync all of the lights’ positions in 3d space, as well as other things that you may not want to sync):

`

foreach (Light lighter in LU)
{ 
      lighter = baseLight;
}
`

the first option is more time-consuming, but it can be customized to copy only certain members of the Light class.

MachCUBED