Tween able to freely reposition children of containers. Why?

Godot Version

v4.2.2

Question

As the title suggests, I’ve discovered that tweens are able to freely reposition the children of containers. Furthermore, once the tween has finished repositioning the child control, the child can be freely repositioned using Control.position. What is happening to make this possible?


I was able to achieve this effect using the following code:
var tween: Tween = create_tween()
tween.tween_property(child_control, "position:y", 1000, 1.0)

I suspected that the tween might have been messing the the Control's parent node or top_level property, so I added the following tests:
	print(child_node.get_parent())
	print(child_node.top_level)
	
	var tween: Tween = get_tree().create_tween()
	tween.tween_property(child_node, "position:y", 1000, 1.0)
	
	await tween.finished
	
	print(child_node.get_parent())
	print(child_node.top_level)
	
	tween.kill()
	
	print(child_node.get_parent())
	print(child_node.top_level)
	
	await get_tree().process_frame
	
	print(child_node.get_parent())
	print(child_node.top_level)
	
	child_node.position = Vector2.ZERO

The results showed that the parent remained the same, and the top_level property remained false throughout each call. Furthermore, setting the child Control’s position to Vector2.ZERO reset the position to the local (0,0) (i.e. relative to the parent Container).

I have no idea what is going on here to allow this to happen, so if someone more knowledgeable than me on this could help me out, I would be really grateful.


Thanks!

It seems you’ve run into this issue

it’s marked as archived and completed, but nothing was ever merged to change it. So i guess the devs know about the issue and decided not to fix it.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.