- Home /
How to disable halo when it is already enabled via script C#
Hello there. I'm working on a scene that does only a simple thing, which is enabling the halo effect on a cube when the raycast hits it and disabling it when the raycast doesn't. This is my code:
if (raycastForward.rayOnObject == true){
Behaviour halo = (Behaviour)GetComponent ("Halo");
halo.enabled = true;
}
else {
Behaviour halo = (Behaviour)GetComponent ("Halo");
halo.enabled = false;
for some reason, the halo is enabled when it look at it but it doesn't disable when I look away. Any help please? Thank you.
Comment