- Home /
Question by
Ata_Utku_Orhan · Apr 02, 2017 at 09:57 AM ·
meshrendererthis
Cannot reach a planes meshrenderer
I am trying to make a plane disappear and appear in certain frames so i locked the fps to 60 and wrote this code:
public int StartFrame;
public int FinishFrame;
public int FPS;
public int Frame;
MeshRenderer Kek = this.gameObject.GetComponent<MeshRenderer>;
void Update () {
FPS++;
if(Frame == StartFrame){
Kek.enabled = !Kek.enabled;
}else if(Frame == FinishFrame){
Kek.enabled = !Kek.enabled;
}else if(Frame == FPS){
Frame = 0;
}
}
MonoScript is telling me "Keyword 'this' is not available in the current context". I read that this. is not necessary to reach the object which the script is attached to so i tried the code without the 'this.' but still no luck.
Comment