Player object goes off screen

I am new to Unity, I have been following the Ruby 2D tutorial.

I have a player object that works ok and interacts with static damage and health objects.
I have added another “guard” object, this just moves left and right guarding and entrance. All work ok until the player object makes contact with the guard object then the player object disappears off of the screen in the direction the guard was traveling at the time of contact.

The guard is not effected in any way by the collision.

Can anyone help in what have i got wrong.

@llewors

“All work ok until the player object makes contact with the guard object then the player object disappears off of the screen in the direction the guard was traveling at the time of contact.”

If both of your character GameObjects have colliders, these will collider if either one has a Rigidbody(2D). Sounds like you are moving your guard with code and then your player gets pushed away.