void OnTriggerEnter2D(Collider2D other) { if (other.tag == coinTarget.tag) { PoolObject.DespawnCoin(other.gameObject); } }
//void FixedUpdate() //{ // rigidbody2D.velocity = moveVector2; //} void Despawn() { transform.position = Vector3.MoveTowards(transform.position, targetPos, moveSpeed); if (transform.position == targetPos) { PoolObject.DespawnCoin(gameObject); } }