// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0) && fList.Count > 0) { GameObject fire = fList[0]; fList.RemoveAt(0); Vector2 cursorInWorldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector2 direction = cursorInWorldPos - (Vector2)fire.transform.position; direction.Normalize(); Rigidbody2D rb = fire.GetComponent <Rigidbody2D>(); rb.simulated = true; rb.velocity = direction * spd; fireball f = fire.GetComponent <fireball>(); f.transform.parent = null; f.isShooting = true; f.thrown(); currentNum--; } }