Why is my game object (door) changing rotation in game mode?

I have a door that looks fine in scene view. It has an animator attached that switches from open to closed based on a Boolean parameter. The animation works fine. But when running in game mode, the door always resets its starting transform rotation to 0. When I uncheck the animator on the object (deselecting it) it maintains its location that I set. Why is the animator resetting its location position?
Please forgive my noobness.

So I’m guessing that your animation starts the door at 0 at time 0, and rotates it to something like 90 after a while. That’s going to give the behaviour you’re seeing - animations are not relative to the world unless you set that up.

So, the way you fix this is like this:

1: Set your door prefab as a child of an empty gameobject. Make sure that the centre of this gameobject is where you want your door to rotate around.

2: Move the animation to the parent gameobject.

3: Now, make sure that the parent always has a rotation of 0 when you place it in the scene, and then rotate only the child object.

This will make the child keep the rotation you placed it in, as it’s the parent’s rotation that’s being animated. The child will only rotate because it’s parent is rotating.

It would be a ton easier if you could use localrotation as a curve in the animations, but animations are sucky and not supported anymore, so this is what you’ve got to work with.

I had the exact problem as you did when updated to newer version of Unity3D (boy, took me ages to figure out it was animator related) and you fix it by unchecking Apply Root Motion at related Animator component