How do I add an animation track for a shader property?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AlbeyAmakiir

I have added an AnimationPlayer to a ColorRect node. I can make keys and tracks for any property with the little key button, but when I click the one for the Material → Shader Param → my_param, the editor doesn’t respond at all. In the Output, I get an error:

core/object.cpp:1228 - Error calling method from signal 'property_keyed': 'EditorPropertyResource::_sub_inspector_property_keyed': Method expected 3 arguments, but called with 1..

I can change other shader parameters, just not mine, so I suspect I’m using the wrong approach. How should I be adding a custom shader param animation track?

:bust_in_silhouette: Reply From: Skuuully

I too have just encountered the same issue. I found that when all of the parameters of my shader were set to default values it wouldnt let me add it to the track.

I then went to verify that my shader was working by playing about with the values, after having done so it then worked when clicking on the little key icon to add to the animation player. The same may help fix your issue? Seems like some strange behaviour for sure.

:bust_in_silhouette: Reply From: AlbeyAmakiir

What I was doing was correct, but I was using the wrong shader type. I was using a spatial shader rather than a canvas shader. I am not yet sure why a spatial shader would not work. Perhaps someone has a better answer. But for now, this is enough for me.

Just saw, that Spatial is for 3D, maybe that was the problem. If you use a 2D scene then as you already figuerd out canvas_item was the right choice.

PeanuT | 2020-10-02 15:58