using System.Collections; using UnityEngine; public class Arrow : MonoBehaviour { void Start() { StartCoroutine(DestroySelf()); } void Update() { this.transform.position += transform.forward * Time.deltaTime * 10f; } IEnumerator DestroySelf() { yield return new WaitForSeconds(3f); Destroy(gameObject); } }