- Home /
Can I hide/destroy certain parts of an object?
I created many obstacles as part of my game scene. I want hide or destroy certain part of these obstacles based on their position. Is it possible to destroy/hide part of an object which lies beyond a certain position?
Are you thinking of Occlusion Culling? http://docs.unity3d.com/$$anonymous$$anual/OcclusionCulling.html
Answer by South05 · Oct 21, 2014 at 12:00 PM
Hide and destroy are two very different things.
like Josh said, OcclusionCulling is probably want you really need. (Pro Only)
if you want to simply hide, disable the renderer if you want to destroy, just call destroy() in your script
A certain position in a specific domain or just something like it's x unit away, destroy it ?
simple example
var part: GameObject;
function Update () {
//Change this condition to what you actually want
if( transform.position.x < 0 ){
//disable the renderer
part.getComponent(renderer).enabled = false;
//or Destroy the object
Destroy(part);
}
Hope that helps
Your answer
Follow this Question
Related Questions
How to create a level indicator? 1 Answer
How to create such a preview of the game scene? 0 Answers
Code in OnCollisionEnter? 1 Answer
Timeline/preview of the game scene. 0 Answers
Multiple cameras in game scene to create preview of the game 0 Answers