+1 vote

My game is a Towe defense, the problem is simple, I was trying to tween a shader param, and just doesn't happen when I call the function, setshaderparam below works, but I want to use a tween node to show the different cooldowns of my units.

enter image description here

Godot version v3.4.3 stable
in Engine by (35 points)

1 Answer

+1 vote
Best answer

I hate this part about Godot - nodepaths are non-intuitive mess. Accessing shader params is best example of that. You need to pass whole path of material/shader_param/progress to Tween, but beware ! There are ":" inbetween "/" in this syntax.
If You want to get 100% correct path for anything add AnimationPlayer to your scene, create Animation, and keyframe ( key icon in editor ) your chosen property. In this case - your parameter of shader material. You will see a new animation channel in animation menu. It will display proper path. Copy it and paste into your script and You can remove AnimationPlayer.

by (7,753 points)
selected by

Unfortunately, It still not working, I tried differents paths even with the one is shown in AnimationPlayer, and I have taken screenshots of some of them, :(

enter image description here
enter image description here
enter image description here
enter image description here
enter image description here
enter image description here
enter image description here
enter image description here

Lots of combinations, but a proper one is missing :)

$Tween.interpolate_property($Button, "material:shader_param/progress",

1st argument is Object, 2nd is a path. You can't use material as 1st argument as it is resource property of an object. As 2nd argument insert path copied from animation player. I assume it is the one from my example

Sorry, I have already tried it, I sent some pictures of many more, but I tried it again and it doesn't work, maybe is the Godot version, what version do you use? I using 3.4.3

I use the same version of Godot.
I opened my old Project and this is how I did it :

tween.interpolate_property(vis,"mesh:material:shader_param/anim",0.0,1.0,0.1)

and this is working

Are You sure You didn't mess up other parts of code ?
First of all : Do You actually call $Tween.start() ?
Second : Did You test changing of your shader param in shader itself ?

Ho yes xD so sorry, I forgot to start tween, it was late at night but now it works, I'll give you the best answer.

Haha thanks :)
Of course the problem is still in Godot, because editor will never send any notification if path to uniform param is incorrect, so it is easy to miss something like starting tween :)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.