- Home /
Is there a possible bug in the renderer.enabled?
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;
}
}
Answer by Paulius-Liekis · Sep 15, 2014 at 08:35 AM
Unlikely. There is probably a bug in your setup. Maybe Renderer is enabled again after being disabled?
Answer by Good_Punk · Sep 15, 2014 at 09:34 AM
Now I feel stupid... you were right. :D Other windows were hidden as well and didn't check if they were shown at that moment then triggered the event themselves with "isShown=false" thus disabling the renderer again.
1000 thanks... anwered! :)
Your answer
Follow this Question
Related Questions
Combining Mesh's For Mesh Deformation 1 Answer
Mesh Renderer and Memory 2 Answers
Is it bad to have many mesh renders? 1 Answer
Lost Lightmap in Mesh Renderer 0 Answers
how to set the uv of the texture(or mesh renderer) 2 Answers