private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.name == "Target") { magnitude = GetComponent <Rigidbody2D>().velocity.magnitude; hit = true; GetComponent <Image>().color = Color.green; nn.GetComponent <Image>().color = Color.green; nn.Finish(); } }