FPS mouse look script for a space game

So i want a mouse look script for a space game, where you can rotate in any direction without gimbal lock - the world doesn’t have an ‘up’ direction. I don’t really have an idea how to do this, I think I should probably use quaternions. Any help appreciated.

Ok, i got it.

transform.localRotation *= Quaternion.Euler(-GetMouseY(), GetMouseX(), 0);