Destory and Hide

please ! is it possible to hide a gameobject in unity without applying the destroy method ? cz the destroy method detroys all of the components of the gameobject :cry:

You’re looking for SetActive(). Use “MyGameObject.SetActive(false)” to deactivate something, and “MyGameObject.SetActive(true)” to turn it back on.

Some other options are to simply move it off the screen out of sight with it’s transform. Or you could also just turn off its mesh renderer if it has one.

There’s probably other creative ways to do it. I’m not sure how performant “SetActive” is, but that might be another option. Enable/disable etc.

i don’t wanna disable it or other thing , i just need to hide it, because once i use SetActive(false) all the instructions tht come after it doesn’t work :cry:

then disable the renderer in the gameobject. It will be hidden.

no actually i wanna make this on a trigger, once the player is on the trigger, the gameobject should dessapear, but in same time and in the same script i have a GUI Texture that should appear and gimme some infos :cry: , once i disable the gameobject, the GUI and their options dnt work at all :cry:

Go try this.

where can i find the renderer :frowning: ?

meow :3~

Reading all the posts and threads you’ve just made, I get the feeling you should have a look at this and get the basics down first: Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn

not working :frowning:
here is my script

#pragma strict

var CUTE : GUITexture;
function start()
{
	CUTE.enabled = false;
	renderer.enabled = false;
}


function OnTriggerEnter(otherObj: Collider){

	if (otherObj.tag == "Player")
	{ 
		Debug.Log("hello");
		CUTE.enabled = true;
		
		yield WaitForSeconds (5);
		CUTE.enabled = false;
		
		this.gameObject.active = false;
		
	}
}

all i need is to hide the gameobject, before the CUTE dissapear :cry:

if (SOMETHING_HAPPENS) {
	renderer.enabled = false;
	collision.enabled = false; // Disable the collision too, just disabling the renderer will not automatically turn off collision/collider and/or trigger, meaning the object is basically still in-tact.
} else {
	renderer.enabled = true;
	collision.enabled = true;
}

As for your code, programming works like a list: you go from top to bottom.
So put the “renderer.enabled = false;” portion above “CUTE.enabled = false;” one to make the object disappear before CUTE.
Also, I noticed that you enable and disable CUTE on trigger, but you never turn on its renderer.
In this case you can also consider to replace “renderer.enabled = false;” to a simple untick in the inspector.