Camera unstable when player hits an object.,camera unstable when following player

The camera follows my player, but as soon as the player hits another object the camera moves or gets lost.

,I have an issue
My camera will follow the player BUT as soon as the player hits a wall or any object, the camera moves away or gets lost

Any advice?

Is your camera a child to your player object?
Does your camera contain a script which would move it?
Does your camera contain a rigid body?
Is there an active collider attached to the camera?

These are some things that can affect the position and rotation of your camera. Setting it as a child to your player and ensuring it does not contain a collider will certainly make it follow you, but depending on what kind of game it is, it probably shouldn’t be a child.