//called when block is hit //SOURCEhttps://www.youtube.com/watch?v=3g5_8sE18tQ void OnTriggerEnter(Collider hit) { if (hit.tag == "Saber" && blockHit == false) //checks to make sure it was the saber that hit it { //Debug.Log(saberSplit.rightDirection); if (checkBlockDirection() == true) //checks to make sure saber is moving in the right direction before actually cutting { woosh.Play(); Destroy(gameObject); //destroys normal cube blockHit = true; Instantiate(Slices, transform.position, transform.rotation); //instantiates new split block object, , transform.position, transform.rotation lightScript.changeBackground(); spawnScript.Hit(); } } if (hit.tag == "MissBox") { if (spawnScript.wasHit == false) { spawnScript.Miss(); } } }