Skip to content

Conversation

@Meorge
Copy link
Contributor

@Meorge Meorge commented Dec 14, 2025

Closes godotengine/godot-proposals#12712 .

This PR adds the set_name() and get_name() methods to Tween. When a Tween is given a name, error messages involving that Tween will display the name. This will help users diagnose which Tween within a scene is experiencing issues, if they have a tween-heavy workflow (i.e., animating lots of things using tweens simultaneously).

Example:

var unnamed_tween = create_tween()
unnamed_tween.tween_callback(func(): print("This tween is looping forever"))
unnamed_tween.set_loops(-1)
# ERROR: Infinite loop detected. Check set_loops() description for more info.

var named_tween = create_tween()
named_tween.set_name("SlideDown")
named_tween.tween_callback(func(): print("This tween is looping forever"))
named_tween.set_loops(-1)
# ERROR: Infinite loop detected in Tween "SlideDown". Check set_loops() description for more info.

@Meorge Meorge requested review from a team as code owners December 14, 2025 18:11
@Meorge Meorge force-pushed the feat/tween-name branch 4 times, most recently from d814262 to ab2f101 Compare December 14, 2025 19:33
@AThousandShips AThousandShips added this to the 4.x milestone Dec 15, 2025
…rposes

Use optional tween names in tweener errors

Make messages more consistent

Apply suggestions from code review

Co-authored-by: A Thousand Ships <[email protected]>

Use `is_empty()` instead of `length() > 0`
@Kaleb-Reid
Copy link
Contributor

Could the name be passed as an optional argument to create_tween()? Another thought is that set_name() could return the same Tween so that you could call create_tween().set_name().set_loops()...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add optional names to Tweens and Tweeners

3 participants