GetComponent on Halo

Hello everyone !

I’m having some troubles on something I really don’t understand.
I have a game object that has a halo component. I want to access it by script, and the compiler says “YOU SHALL NOT PASS !”

Here is my function :

	void MakeItGlow(GameObject cross) {
		cross.GetComponent<Halo>().enabled = true;
	}

The error is :

error CS0246: The type or namespace name `Halo' could not be found. Are you missing a using directive or an assembly reference?

I tried without the quotes, and then the error is :

error CS1525: Unexpected symbol `)'

So, what is going on ??? I accessed a thousand times different components, but this one does not want to. Is there something new in Unity 5 on this particular component ?

Halo is a Behaviour, which is a Component. So…

Behaviour halo = (Behaviour)GetComponent(“Halo”);

halo.enabled = true; // false

See this answer:

Is cross public? If not, make it public. Then, in the editor, move the halo to the new box under the script in your gameobject.

Use a light component that has the Halo checkbox checked, then just access the light. You’ll be able to access/change the halo’s color, and other properties.