How to make an object INVISIBLE in Unity from a script

preview_player
Показать описание
In this video we see how to make an object disappear in Unity using code instructions, to make this effect an alternative is to disable the renderer component that is showing the object on screen and that way make the object invisible, something that happens in just one frame.
This method to make objects invisible in Unity works both for 2D and 3D objects, the trick is to disable the proper component, 2D objects are rendered using the "Sprite Renderer" component while 3D objects are rendered using the "Mesh Renderer" component, but both of these components are "Renderer" components (both inherits from th "Renderer" components) so with the method we see in this video we can make invisible both 2D and 3D objects in Unity with the same code.
Рекомендации по теме
Комментарии
Автор

so using scripted invisible items in unity is very useful (thanks :D )
but if you want it to be just invisible permanently you can just turn off the mesh renderer in the properties of your item

ProfessorSlimSlam
Автор

jab me on kar raha hun to dikha rha hai camera not difined

ShortsGhost-tcjl
welcome to shbcf.ru