Why is it that when I setScale node when I rotate the screen, my node scales to the correct ratio but is not displayed correctly on the screen?

view.setOrientation(macro.ORIENTATION_PORTRAIT);
const frameSize = screen.windowSize;
screen.windowSize = new Size(frameSize.height, frameSize.width);
const ratio = screen.windowSize.height / this.node.getComponent(UITransform).height;
view.setDesignResolutionSize(screen.windowSize.width, screen.windowSize.height, ResolutionPolicy.FIXED_HEIGHT);
this.node.setScale(ratio, ratio, 1);
This is a node I added to the Scene
@Tom_k please help me! ccc 3.8.4

Could you please provide the demo for us to check?

Test.zip (8.0 MB)
When I click add load bundle I re-set the prefab size which is not correct, can you help me? @Tom_k version 3.8.4

Can I regenerate the problem on website?

Of course you can try on the website


Try the method in the screenshot. normally you can adjust the view when trigger the onresize method.
Of cause you should destroy the view.on behavior after quit this view.

As you can see, I added the prefab and scaled it but it’s not full screen, there are still black layers