Disable Shadows of Mesh Instance by code?

Godot Version

4.2.1

Question

Is it possible to disable the shadow of a mesh instance 3d by gdscript?

Yes, here is the example

var mesh_name = get_node("MeshInstance3D") 
mesh_name.cast_shadow = false

Editor said mesh_name.cast_shadow is not a bool and it is ShadowCastingSetting. After correction it worked. Thanks for your reply.

1 Like