I have a couple of quads and I want to hide them. So I attached a script listening to an event and then disabling the meshrenderer. It works for every object but one. They all have the same scripts attached and they are all duplicates of one another. There is no error message and the event is called properly (the Debug text is shown in the console)
But the mesh renderer on this one particualr quad just won’t turn off. (You can observe that behavior easily in the editor). Am I doing something wrong or might this be a bug?
void Start () {
ShowSettings.ChangeShown += HideClouds;
float range = Random.Range (0.8f, 1.2f);
int aniPoint = Mathf.RoundToInt(aniLength * range);
this.animation [aniName].time = aniPoint;
}
void HideClouds(bool isShown){
if (isShown) {
Debug.Log (aniName);
this.gameObject.renderer.enabled=false;
} else {
this.gameObject.renderer.enabled=true;
}
}