Anchor Points Don't Change Positions

Godot Version

4.2.1

Question

Title says it all, no matter what method I use, I CANNOT change the locations for anchor points for any UI element. When placing a Control node, it also says that it doesn’t have a Control node, which, yeah, you ARE the Control node, so I don’t know what that’s about. I setup it’s layout left-to-right just in case “Inherited” was causing the issue, but to no avail. Whether it’s dragging with the mouse, or setting it in the Inspector, the Output shows that the Anchor Point HAS been moved, but visually, nothing changes. I’ve tried restarting Godot to see if that would update the position, but No. Anchors Preset? No, nothing changes, all 4 anchors remain in that same topleft corner, and any UI child has to be offset from that position in order to go anywhere. Now, I’ve tried that method in an older version of Godot, and let me tell you, that throws out all sorts of visual issues when running, so doing that is a lot like slapping a tiny bandage on a gaping wound. You’re gonna notice someone did a horrible job. Has anyone had this same issue? Why won’t the Anchors move? Did something change from the original 4.1 version that just makes it so that Anchor Points are now obsolete? Honestly, between this and needing to reinstall Godot just to be able to run a scene in the editor, I’m wondering what exactly was done in the latest update, when I first started Godot everything was smooth sailing, now it’s a headache just to look at the desktop icon… Not visually, just in knowing that everything I want to do is going to go wrong, even something as simple as changing an Anchor’s position…

If the parent is or inherits from a Node2D then the anchors won’t be able to correctly calculate their position. Don’t mix Node2D with Control nodes.

1 Like

Hey, thank you so much for your response! I swear I remember doing this last time, too. That’s a head smack moment if I’ve ever had one. I’ve got to make the User Interface scene separately from the Node2D scene, then use the UI scene as a child of the Node2D. Correct me if I’m wrong, if you can’t tell I’m still a very new developer!

What is the correct way of building 2D scenes with GUI then? Should I make the root scene a Control and have the gameplay Node2D scene as a child of the UI?

It depends.

What I meant with “don’t mix Node2D with Controls” was in relation with modifying the anchors which you will lose if you mix them.

Generally speaking:

  • if it’s a HUD then you should use a CanvasLayer as the parent of the GUI. Something like:
- Level (Node2D)
	- TileMap
	- Player
	- Enemies
	- HUD (CanvasLayer)
		- Score (Label)
		- Health (ProgressBar)
  • If it follows the Node2D like a Label with the player name or a ProgressBar to show the health then adding them as a child of a Node2D is okay. Something like:
- Enemy (CharacterBody2D)
	- Sprite2D
	- CollisionShape2D
	- Health (ProgressBar)
1 Like

Makes sense! Thanks a lot for your response. :+1: