Open a scene that is not the main scene in the editor and press F5 to run the project. The UI size of the main scene will change. But when the main scene is opened in the editor, pressing F5 will run the project, and the UI size of the main scene will be displayed correctly
Please show images to help us understand. It would better to show us the tree and problem than ask us to recreate the error with no knowledge of what scripts are happening, and the tree.
This happens because the base for your UI (the sence_BG) cannot ‘expand’ accordingly to the parent(as it is a Node2D and not a Control Node)
You can fix this by
changing the main node to control (and making it expand)
adding script to change the position of UI accordingly
Personally I prefer method 2. as it allows me to use it in other nodes as well.
Thank you. After some research, I found that the problem should be caused by AnimationPlayer(UI_roll) nodes.After I deleted AnimaitionPlayer(UI_roll), the problem disappeared.