Disable/Enable object imported from 3ds max

Hello to all,

First of all thanks for this awsome game engine :smiley:

I’m having a problem in disable the rendering and the animation of one imported model from 3ds max. I’ve tried gameObect.enabled = false, gameObject.active = false, even added one Mesh Renderer to the object and tried gameObject.renderer.enabled = false. None of these worked, the object is always displayed. Is there any other option i could try?

I’m doing that on the pause menu:

function OnGUI(){

GameObject.Find("MenuCam").GetComponent("Camera").enabled = true;
GameObject.Find("MenuCam").GetComponent("Camera").transform.LookAt(Vector3.zero); 
GameObject.Find("MenuCam").GetComponent("Camera").transform.Translate(0.05,0,0);

rect = new Rect(0, 0, 150, 75);
rect.x = (Screen.width  - rect.width ) / 2;
rect.y = ((Screen.height - rect.height) / 2)-50;
if(GUI.Button(rect, "Jogar")){
	GameObject.Find("MenuCam").GetComponent("Camera").enabled = false;
	GameObject.Find("bus").enabled = false;
	this.enabled = false;
}

The object bus is one model imported from 3ds.

The problem is where i want to make the bus not visible.

Thanks

Set your gameObject’s active property to false, not enabled. The enabled property is for components (scripts on a game object) while active is for the gameObject itself. So your code will look like this:

 GameObject.Find("bus").active = false;

I have found what my problem was, i needed to set the children active status to false.

I’ve used this function gameObject.SetActiveRecursively(false);