[ad_1]
Hi,
@StudioAMK has an in depth tutorial on this, you may test it out right here:
Unfortunately, the code doesn’t work in Cocos Creator 3.6.1, so right here is the up to date code:
makeResponsive() {
let deviceResolution = view.getViewportRect();
let deviceRatio = deviceResolution.width / deviceResolution.top;
let canvasResolution = view.getDesignResolutionSize();
let canvasRatio = canvasResolution.width / canvasResolution.top;
if (deviceRatio > canvasRatio) {
view.setResolutionPolicy(ResolutionPolicy.FIXED_HEIGHT);
} else {
view.setResolutionPolicy(ResolutionPolicy.FIXED_WIDTH);
}
}
*You must learn the unique tutorial (linked above) if you happen to don’t perceive the aim of this code snippet.
1 Like
[ad_2]