Is there a way to set a single transform axis to world?

I need to prevent a camera component from moving along the Y axis. To achieve this I am setting the camera’s world location on Tick. I was wondering if there was a better way to do this, and if I am adding unnecessary overhead. I’m assuming by doing it the way I am, the camera position is actually getting set twice. First when I move the pawn, then again when my script is run. For example, I press up on the gamepad, the pawn moves along the Y axis and the camera is positioned accordingly, then my blueprint sets it again to where I actually want it.