Problems with light.intensity when upgrading from Unity 4.5 to Unity 5

Hi everyone,

I’m having trouble with this script. It was working perfectly when using Unity 4.5 but now that I have upgraded, I get the following error on the last 2 lines:

Assets/Scripts/UnitScript.js(54,55): BCE0019: ‘intensity’ is not a member of ‘UnityEngine.Component’.

Here is the script :

function HighlightSelected() {
if (menuObject.GetComponent(ClientScript).selectedObject == this.gameObject) {
var phi : float = Time.time / 1 * 2 * Mathf.PI;
var amplitude : float = Mathf.Cos( phi ) * 2;
this.gameObject.GetComponentInChildren(Light).intensity = amplitude;
targetDestination.GetComponentInChildren(Light).intensity = amplitude;
}
}

Any help will be appreciated :slight_smile:

adding the true argument seem to have fixed the problem

Thx anyway!

this.gameObject.GetComponentInChildren(Light, true).intensity = amplitude;