godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.47k stars 21.07k forks source link

Stretch Mode Canvas Item not working #57134

Closed stryker313 closed 2 years ago

stryker313 commented 2 years ago

Godot version

v4.0.alpha1.official.31a7ddbf8

System information

Windows 10 GTx 1060 i5 4690k

Issue description

Stretch mode canvas does not work. All elements remain their initial size. Also plagues override resolution, but thats for another issue.

https://user-images.githubusercontent.com/83078010/150829596-441e1684-41ae-4d39-98e5-231d5dcac5c1.mp4

Steps to reproduce

  1. Create UI elements
  2. Enable Stretch mode canvas in project settings
  3. Run the game at default resolution
  4. Run the game at 1920x1080, and you will see that the items do not stretch

Minimal reproduction project

[Uploading aaaa.zip…]()

Calinou commented 2 years ago

@stryker313 The minimal reproduction project failed to upload, please try again.

Also, remember you may be encountering https://github.com/godotengine/godot/issues/55145. As a workaround, try to run the project twice.

stryker313 commented 2 years ago

aaaa.zip

KoBeWi commented 2 years ago

Not sure what you are expecting, but this works correctly: godot windows tools 64_jKgO6O0a8X What you set in viewport width/height is used as a default reference size, so changing it has no effect on scaling. What you are looking for is window width/height override, which is hidden under Advanced Settings.

Zireael07 commented 2 years ago

What you set in viewport width/height is used as a default reference size, so changing it has no effect on scaling. What you are looking for is window width/height override, which is hidden under Advanced Settings.

Needs to be better documented then, I expect many new users will run into this.

KoBeWi commented 2 years ago

This is explained here: https://docs.godotengine.org/en/latest/tutorials/rendering/multiple_resolutions.html#stretch-mode These properties were renamed for better clarity.

Zireael07 commented 2 years ago

It's not made clear enough in https://docs.godotengine.org/en/latest/tutorials/rendering/viewports.html, though. Scale and stretching aren't clarified enough, nor is the meaning of 'size' made clear in the API docs https://docs.godotengine.org/en/latest/classes/class_subviewport.html#class-subviewport

Calinou commented 2 years ago

It's not made clear enough in docs.godotengine.org/en/latest/tutorials/rendering/viewports.html, though. Scale and stretching aren't clarified enough, nor is the meaning of 'size' made clear in the API docs docs.godotengine.org/en/latest/classes/class_subviewport.html#class-subviewport

Please open an issue for this on the godot-docs repository (and ideally a pull request for the Viewports page :slightly_smiling_face:). For the SubViewport class reference, edit https://github.com/godotengine/godot/blob/master/doc/classes/SubViewport.xml on the main Godot repository and open a pull request.