Does the two code samples differ?

Why does this work

#pragma strict



function Update()
{
	var greenSlider : float = GameObject.Find("SliderGreen").GetComponent.<UnityEngine.UI.Slider>().value;
	var blueSlider : float= GameObject.Find("SliderBlue").GetComponent.<UnityEngine.UI.Slider>().value;
	var redSlider : float= GameObject.Find("SliderRed").GetComponent.<UnityEngine.UI.Slider>().value;
	var alphaSlider : float= GameObject.Find("SliderAlpha").GetComponent.<UnityEngine.UI.Slider>().value;
	var coolColor : Color = Color(redSlider ,greenSlider ,blueSlider ,alphaSlider);
	var camera = GameObject.Find("Camera 32");

	camera.GetComponent.<Camera>().backgroundColor = coolColor;

}

But not This

`#pragma strict



function Update()
{
	var greenSlider : float = GameObject.Find("SliderGreen").GetComponent.<UnityEngine.UI.Slider>().value;
	var blueSlider : float= GameObject.Find("SliderBlue").GetComponent.<UnityEngine.UI.Slider>().value;
	var redSlider : float= GameObject.Find("SliderRed").GetComponent.<UnityEngine.UI.Slider>().value;
	var alphaSlider : float= GameObject.Find("SliderAlpha").GetComponent.<UnityEngine.UI.Slider>().value;
	var coolColor : Color = Color(redSlider ,greenSlider ,blueSlider ,alphaSlider);
	var camera = GameObject.Find("Camera 32").GetComponent.<Camera>().backgroundColor;

	camera = coolColor;

}

I know it might be simple but i don’t get it

Because in the first code you set value, but in second code you firstly retrieve value and then just modify retrieved value (value is not set to camera’s script variable).

Also that is a bad habit to find and get in Update each time over and over again, as instead you should do like that:

Camera cam32;
void Awake()
{
    cam32 = GameObject.Find("Camera 32").GetComponent<Camera>();
}
//and then in Update:
if (cam32 != null) cam32.backgroundColor = coolColor;

P.S. Unless you spawn/delete camera all the time, if so then either set cam32 variable from a cam32 instance to itself or on update:

    if (cam32 == null) cam32 = GameObject.Find("Camera 32").GetComponent<Camera>();
    if (cam32 != null) cam32.backgroundColor = coolColor;