Just worked my way through another chapter of my Unity book, and I was met with a most formidable challenge today.
It sounds simple, but it's surprising how much trouble a simple sliding door can give a person. The door was set to open when the player touched it and close a few seconds later. But when I first set it up to do this, the door looked like someone had kicked it in as soon as I started the game.
I figured out it was a problem with the door colliding with the wall surrounding it, and I adjusted it accordingly. Now the door could open when I touched it. But when it closed... well...
When the door closed, it would slowly float off its hinges in a random direction as if it were floating around in space. If I walked over and touched it while it was floating, it would instantly appear back where it was supposed to be and open, then close and float off again. I watched the door slowly float off into the sky at one point.
I tried setting it so gravity would apply to the door. Now it would look fine when the game loads, open fine, and then when it closed, it would fall forward on the stairs leading up to it. So I undid that and adjusted the size again in case it was still colliding with things when it closed. Now it would float away as soon as the door opened.
Finally I realized that it was a checkbox I left unchecked causing the problems. I thought my book said "uncheck this box" when it really said "check this box". Whoops.
If anyone sees a metal door slowly floating across the sky, that's mine. Please let me know.