- Home /
Question by
fajarazizlaksono · Apr 22, 2013 at 02:26 PM ·
meshrenderer
renderer cannot enabled ..
what wrong with this script ??? at the beginning, mesh successfully enabled, but when mesh renderer not active and i am want to enable it again but that cannot active more, what's wrong?
sorry my bad english and thanks you
that my script : Can you fix it?
public var isMeshOn :boolean ;
function Start()
{
isMeshOn = true;
}
function Update () {
if(Input.GetKeyDown(KeyCode.F))
{
if(isMeshOn)
isMeshOn = false;
else
isMeshtOn = true;
}
if(isMeshOn){
gameObject.renderer.enabled = true;
}
else{
gameObject.renderer.enabled = false;
}
}
Comment