How can make a cube that fell of the platform and reached Y - 80 3 times and make it disappear off the scene (get destroyed).
- Felipe
How can make a cube that fell of the platform and reached Y - 80 3 times and make it disappear off the scene (get destroyed).
On your cube, add a new script.
Let that script have a counter for the number of times you have fallen off the platform.
Give the script a reference to your current platform (and don’t forget to update that regularly).
Now, test for the player’s position relative to the platform and increment your conter: “if (platform.transform.position.y - this.transform.position.y > 80) { fallCount = fallCount +1 }”.
Finally: Test if your fall-counter is 3 and then destroy the gameobject: “if (fallCount == 3) { GameObject.Destroy (this.gameObject); }”