Camera issues.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraController : MonoBehaviour {

public float x;
public float y;
public float rotationspeed;

void Update()
{
    Rotation();
}

public void Rotation()
{
    x = Input.GetAxis("Mouse X") * rotationspeed;
    y = Input.GetAxis("Mouse Y") * rotationspeed;

    transform.eulerAngles = new Vector3(y, x, 0);
}

}

My camera keeps resetting back to the center of the screen everytime I move along the y or x mouse axis. I’m not sure why.

This because as soon as you stop moving your mouse, the GetAxis of both, x and y start returning 0, but the Update is still executing; resulting in variables x and y getting 0, and thus your problem. Try keeping this rotation on a mouse button press or something may be? Like:

 void Update()
 {
    if(!Input.MouseButton(0))
        return;

     Rotation();
 }

@artofshashank is right, but I believe what you are looking for is an FPS-like camera. So you will have to do the following :

 public void Rotation()
 {
     x += Input.GetAxis("Mouse X") * rotationspeed; // Mind the += operator
     y += Input.GetAxis("Mouse Y") * rotationspeed; // Mind the += operator
     transform.eulerAngles = new Vector3(y, x, 0);
 }