Fit background to window

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Mxt08

I am making a game that have a control root node and a color rect inside it.
But when I resize my window or try it in my mobile, the background doesn’t cover all the window. How I can fix this problem using gdscript?
Thanks in advanced.

:bust_in_silhouette: Reply From: MintSoda
  1. Select root Control first.
  2. Below scene tab bar, there is a “Layout” button. Click that, and select “FullRect” in its drop-down menu. This way the Control will resize with its parent, which is the game window (Technically the parent is SceneTree’s root node, a Viewport.).
  3. Do the same to same to ColorRect. This way it will resize with its parent, which is that root Control.

Plus: Essentially, those “Layout” options are anchors and margins presets for all Control nodes.