I have my project with 2 cameras. One is the main camera, that captures the gameplay and follow the player.
The Problem i had is that when the camera start to move the ui stay in place and get outside of the screen.
so what i did is to add a second camera and put aside of the game area.
I had a similar issue. My solution was to not have anything be a child of the canvas. Cocos would constantly recreate the camera thats attached to the canvas but I just ignored it and had a duplicate camera follow the player instead. The main camera that is a child of “cameras” would be the one that followed the player. Everything else had a root node that wasn’t the canvas like below.