is this possible?
can I delete cloned falling objects when they get at a certain y position ? this is the code I got.. i want it to get deleted when the objects get to -10 at the y pos
loopy = GameObject.Find("floorLevel1");
function Start (){
clonedObject = Instantiate(loopy,transform.position +relativePositionOffset, Quaternion.identity); if(transform.position.y>200){ Destroy (gameObject);
Answer by darthtelle · Aug 31, 2015 at 11:06 AM
Try placing the destruction code in the update loop. That way it's checking every frame whether the object needs to be destroyed. Also, here's a link to read up on the differences between Start() and Update().
void Update()
{
if(transform.position.y < -10)
{
Destroy(gameObject);
}
}
yeah thats the only thing that has got it to work but it makes it stop instantiating and i kind of want it to loop or pool
Follow this Question
Related Questions
Player not deleting 2 Answers
Delete all component but not Renderer/MeshFilter at RunTime 0 Answers
How to delete tutorial game published to web 1 Answer
Unable to delete certain things in scene view? 0 Answers
How to delete downloaded Projects 0 Answers