I cannot for the life of me figure out what I am doing wrong. I have gone through several different tutorials and walkthroughs, but nothing seems to work. I want a “Ceiling” to eventually crush the “Player” if they don’t make it to the exit in time. The player is tagged as “Player” and has a kinematic rigidbody attached. The ceiling has the following script attached.
I understand that you want to destroy the player object and you said that “The ceiling has the following script attached”, so when you do “Destroy(gameObject);” you are destroying the ceiling (if the code works). Change it to “Destroy(collision.gameObject);” and that should work, let me know if that solves the issue!
This code will destroy the ceiling and also your code.
you found the player by tag but the destroy action will not be applied to that player unless you correctly specify it.