hello,
i was create multiple balls with clones, and i want to delete that clones one by one, if i use "Destroy(gameObject)" command that game object was entirely deleting with its clone also, can any one say the ans for it?
hello,
i was create multiple balls with clones, and i want to delete that clones one by one, if i use "Destroy(gameObject)" command that game object was entirely deleting with its clone also, can any one say the ans for it?
Actually i have created clone balls using instantiate, and much harder when i'm trying to destroy.
Finally i got the answer for it.here it is,
function Update ()
{
if( transform.position.y-nxtPos.y <= 9.9 && ballcreate == false)
{
offset = Vector3(0,60,0);
clone = Instantiate (Sphere1,transform.position + offset, transform.rotation);
ballcreate = true;
}
}
function FixedUpdate()
{
time = time+ Time.deltaTime;
if(transform.position.y <= 180)
{
Destroy(gameObject);
}
}
it'll destroy your game objects continuously when it reaches certain distance.
thank all.
we can easily delete multiple clones with simple using "Tags".... first we need to tag all clones using "GameObject.FindGameObjectsWithTag("something")"....
assume tag name : "Lock"
void deleteLocks()
{
foreach(GameObject gos in GameObject.FindGameObjectsWithTag("Lock"))
{
if(gos.name == "Locked(Clone)")
{
Destroy(gos);
}
}
}
here all the clones with tag name "Lock" will destroy easily........