How to stop camera in a 2D game in a certain coordinate.x?

I need to stop the camera to do a fight with the boss in a space game like gradius. How can i do that?

Any help will be apreciated. I’ve done a lot of things but nothing was useful.


For game like Gradius you must create a simple parallax effect for your background. And when you wanna stop the camera you need only stop your parallax

Look to the end

Or if you wanna just a stop your camera in some point, you would add needed coordinates on Update. For that create new script from MonoBehaviour for your Camera

void Update()
    if (isBoss)
        Vector3 pos = gameObject.transform.position;
        pos.x = neededX;
        gameObject.transform.position = pos;