soda
August 16, 2026, 12:10pm
1
Godot Version
4.7
Question
I am trying to tween my label’s shadow color, but I get this error:
Cannot call method ‘set_trans’ on a null value.
Which probably means I am trying to change a property that doesn’t really exist?
Here’s the code:
extends ButtonTMP
func activate():
state = STATE.TRANSITION
self.self_modulate.a = 0.1
var _f = create_tween()
_f.tween_property(self,"theme_override_colors/font_shadow_color",
Color("8400ffaf"),0.4).set_trans(Tween.TRANS_QUAD)
await _f.finished
state = STATE.ACTIVE
Kynji
August 16, 2026, 12:15pm
2
tween_property() returns a Tweener, but set_trans() should be called on the Tween itself. Try:
var tween := create_tween()
tween.set_trans(Tween.TRANS_QUAD)
tween.tween_property(self, "theme_override_colors/font_shadow_color", Color("8400ffaf"), 0.4)
If that still doesn’t work, does ButtonTMP actually inherit from a Control that supports font_shadow_color?.
soda
August 16, 2026, 12:27pm
3
Thank you for replying!
I am pretty sure that this is not an issue, as the official Godot documentation contains this line of code:
var tween = get_tree().create_tween()
tween.tween_property($Sprite, "modulate", Color.RED, 1).set_trans(Tween.TRANS_SINE)
But I tried your solution, and it works in a sense because I don’t get an error, but it doesn’t actually change the property once I launch the game—or, if it does, it has no visible effect. (I will check it)
As for ButtonTMP, it inherits from a Label node.
Kynji
August 16, 2026, 12:35pm
4
Is font_shadow_color enabled in the theme overrides?
soda
August 16, 2026, 12:39pm
5
Yes.
Tho I think I solved it myself already.
Not sure what the problem was, but I just use tween_method, method instead.
Here it is just in case:
func activate():
var _f = create_tween()
_f.tween_method(change_color,Color("8400ff00"),Color("8400ffaf"),0.4)
await _t.finished
state = STATE.ACTIVE
soda
August 16, 2026, 12:40pm
6
I accidentally sent the wrong thing my bad…
soda
August 16, 2026, 12:43pm
7
Here’s my solution for real this time:
func activate():
var _f = create_tween()
_f.tween_method(change_color,Color("8400ff00"),Color("8400ffaf"),0.4)
await _f.finished
state = STATE.ACTIVE
func change_color(value: Color):
self.add_theme_color_override(“font_shadow_color”, value)
Not sure if this is the right way to do it, but if it works, it works, I guess.