void Update() { if (target == null) { Destroy(gameObject); return; } Vector3 dir = target.position - transform.position; float dis = speed * Time.deltaTime; if (dir.magnitude <= dis) { economy.AddMoney(); Destroy(target.gameObject); Destroy(gameObject); return; } transform.Translate(dir.normalized * dis, Space.World); }