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 !
↧