Im trying to hide a specific game object (as in not render it) unless I press a certain key.
So far I have this.
function Update(){
var ShowObject = Input.GetAxis("ShowObject");
if(ShowObject=1)//"Show" key pressed
/*Render Object, I don't know what to put here*/;
what code can I insert to make this work?
If the script is on the object you could so something like this:
if(showObject == 1)
{
renderer.enabled = true
}
else
{
renderer.enabled = false
}
btw, try and use camelCase for variables (start variables with a lowercase, keep capitals for Classes), it’s a common convention.