using System.Collections; using System.Collections.Generic; using UnityEngine; public class arrowSpawn : MonoBehaviour { public float force = 1000f; // Start is called before the first frame update void Start() { this.GetComponent().AddRelativeForce(new Vector3(0f, 0f, force)); StartCoroutine(Despawn()); } // Update is called once per frame void Update() { transform.rotation = Quaternion.LookRotation(Vector3.forward, this.GetComponent().velocity); } IEnumerator Despawn() { Debug.Log(this.GetComponent().velocity); yield return new WaitForSeconds(5f); Debug.Log(this.GetComponent().velocity); Destroy(this.gameObject); } }