How to remove black border in game

Godot Version



how do i remove black border in game with the aspect staying in keep?

Do you mean how to set your stretching mode?

Or do you mean how to resize the viewport so it fills the window?
For that latter one, you make a script that receives the resize notification and sets the viewport size to the window size (or use GUI containers).
You can get the current viewport with get_viewport() from any node and the screen size from DisplayServer.screen_get_size().

1 Like

You will always get black bars when using the keep stretch aspect if the window’s aspect ratio doesn’t match the project’s base aspect ratio. This base aspect ratio is determined by the project’s base window width and height (or the equivalent properties on the root Viewport node set at runtime).

It’s recommended you use the expand stretch aspect and design your project to support multiple aspect ratios instead, as described in Multiple resolutions.