I found the problem. the fact is that in the main player control script there was a page where there was a check for true. If false, the line of making the camera inactive was executed.