I made a simple animation in the animation editor (a door swinging open) and then save this door with its anim to a prefab. Then when I duplicate the prefab and rotate the door to fit in different doorways the animation always plays from a fixed 'global' rotation ie the start and end positions of the original door..the prefab rotations arent taken into account.
How do I make the animation follow local rotations? If thats not possible it makes the animation system useless for prefabs right?
As a basic best practice, specifically for the kinds of problems you're getting here, you should only really animate children of the object you've added the animation component to.
Objects rotate and position themselves in the coordinate system of their parent objects, same when animated. The “local pivot” on the parent shows you the center and orientation of the coordinate system. If you animate the Y position of an object, it will move along the Y direction of the parent coordinate system. Rotations are a bit more fancy but still basically the same.
An object without a parent is basically moving around in the unity world coordinate system. Animations done in the world system will always put the object in the same spot and orientation as you animated them. Moving them around does not have any effect, since the animation controls the position and rotation values while it’s running.
In the door example:
Create an empty GameObject and call it for instance “DoorParent”, then link the door to it. When you now animate the door opening, the movement is happening in the doorparent coordinate system, and moving the doorparent around allows you to position the door with the animation intact.
You're doing something wrong (can't really say what). Animations work in "local space", so if you move parent everything should work. If it wasn't supported it wouldn't be possible to do any character controllers using such animation system.