Question by
paulbertrand567 · Oct 08, 2017 at 09:13 AM ·
camerajavascriptrenderingbeginner
Hide GameObject and children
Hi ! I can't fix the different issues i encounter when i try to hide a GameObject... I can't use the SetActive function because of the situation. Can someone help me using the renderer.enabled method ?
Here is my JS:
#pragma strict
var primary : GameObject;
var kobra : GameObject;
function Start () {
kobra = GameObject.Find("KobraSight");
}
function Update () {
if(Input.GetButton("Fire2") && primary.activeSelf){
kobra.GetComponent(Image).enabled = true;
// Hide renderers of "primary" GameObject
//...
//
}
}
if( ! (Input.GetButton("Fire2") && primary.activeSelf)){
kobra.GetComponent(Image).enabled = false;
// Show renderers of "primary" GameObject
//...
//
}
}
Thank you in advance !
Comment
Your answer
Follow this Question
Related Questions
Weird Rendering Unity5 1 Answer
Camer do not render correctly! 0 Answers
Scene and game view in old project became completely black. 0 Answers
Render only arms of the whole body 0 Answers