The code does not work. I want to 2 in a collision object is deleted collider. Thank you in advance for your response.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class RingsMove : MonoBehaviour {
public float speed;
public GameObject Rings;
public Collider2D coll;
void Start () {
}
void Update () {
Rings.transform.Translate (new Vector3 (0, -1, 0) * speed * Time.deltaTime);
}
void OnCollisionEnter2D (Collision2D col) {
if (col.gameObject.tag == "BackgroundTag") {
Destroy (gameObject);
}
if (col.gameObject.tag == "RocketTag") {
speed += 0.5f;
Vector3 RingsPos = new Vector3 (Random.Range (-2.2f, 2.2f), 5.3f , 0f);
Instantiate (Rings, RingsPos, transform.rotation);
Destroy (coll);
}
}
}