How do i easily center a texture rec?

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

I’m just trying to make a simple crosshair. I know to add a control node to the camera and add a texture rect with my crosshair image to the control node, but I can’t figure out how to center it, hopefully in a way that would work with multiple aspect ratios.

What’s the best way to center a texture rect on the screen?

:bust_in_silhouette: Reply From: exuin
  1. Click the layout button. Click center.
  2. Add it as a child of a centercontainer with the full rect layout
  3. make it full rect layout, stretch mode keep centered

Thanks, that worked perfectly. =D

Millard | 2022-05-20 05:49