using System.Collections; using System.Collections.Generic; using UnityEngine; public class FlyLogic : MonoBehaviour { public float speed = 10; // Start is called before the first frame update void Start() { this.Invoke("BulletDestroy", 5); } // Update is called once per frame void Update() { this.transform.Translate(0, 0, Time.deltaTime * speed); } void BulletDestroy() { Object.Destroy(this.gameObject); } }