0 votes

So I'm having an issue with trying to use a tween to change a shader parameter.

I'm using the following:

tween.interpolate_property(get_node("."), "shader_param:cutoff",
    0.0, 1.0, 1,
    Tween.TRANS_EXPO, Tween.EASE_IN_OUT)

The inspector looks like this and this is the parameter I am trying to tween.
enter image description here
So the parameter definitely exists but I have no idea how to get its property to change because every time I try, this happens.

_build_interpolation: Tween target object has no property named: shader_param:cutoff.

I have tried "shaderparam/cutoff" and ":shaderparam:cutoff"...
I have looked through the docs for this and I can't find anything about it. I am using v3.2.1.stable.official

in Engine by (12 points)

1 Answer

+2 votes

Look where you're hovering. shader_param:cutoff is a property of the shader material object, not of the node.

by (21,305 points)

That would make sense. I will try to use that as a starting point, assuming get_node("./shader") or similar will actually get to the correct thing haha

A comment saying "use get_material() instead of get_node" would have been VERY HELPFUL.....

Help is provided on a best-effort basis. Feel free to edit your first post to mention get_material() still :)

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 webmaster@godotengine.org with your username.