void OnCollisionEnter(Collision collision) { int awardedPoints = (int)(Random.value * 1000f); Spaceship.AddScore(awardedPoints); Transform instance = Instantiate(explosionPrefab) as Transform; instance.position = transform.position; Destroy(gameObject); }