Im having trouble with changing a shader param through gdscript while the game is running, the game starts up fine but when I run this I get this error:
“E 0:00:03:428 _on_glass_default_water_glass: Invalid call. Nonexistent function ‘get_material’ in base ‘MeshInstance3D (water_mesh.gd)’.
water_mesh.gd:11 @ _on_glass_default_water_glass()
water_mesh.gd:11 @ _on_glass_default_water_glass()
glass_pass.gd:7 @ _on_main_water_main()
main.gd:29 @ _on_root_water_confirm()
root.gd:30 @ _on_gameui_wateron()
gameuimain.gd:18 @ _on_button_pressed()”
I have tried extends: node3d and Material but still get the same issue. Id appreciate some help!
You don’t need $"." mesh instance 3d does not have a material, it does have material overrides and specific surface overrides. Where does your shader material live that you want to change?
thanks for helping, the path is Main/Glass/WaterMesh from Root (made children editable just for show) Im sending the input from gameui to canvaslayer to root to main to glass and to watermesh which has a surface material override with a shader. Thats where Im trying to use the input as a trigger to up a counter that then sets the parameter. I know its a little clunky haha, but I am a beginner. also the path for the shader: /new-game-project/assetscopy/Glass.gdshader
Path looks fine, and the script is finding it since it’s attached directly to it. What material do you want to edit though? The material override, material overlay, one of the surfaces?