- Home /
Question by
gingerwhale · Jul 07, 2016 at 08:13 PM ·
2dscriptingbasicsdestroy objectdestroy-clones
2D destroyer moves
ive created an destroyer to get rid of all clones repeatedly entering the scene, in order to enhance performance. But is enloy destroy the first set and then seems to take over the destoryed assets place and moves to the left in the same speed it would have. Heres my script:
using UnityEngine; using System.Collections;
public class Destroyer : MonoBehaviour {
void OnCollisionEnter2D(Collision2D col){
if (col.gameObject.tag == "obstac") {
Destroy (col.gameObject);
}
}
}
Comment