@Cabeza
If healthy state of mind is your life priority, forget about local_to_scene flag and the place where it is located! Its only purpose it to make game developers go bananas!
The method I've found guaranteed to work all the time is to manually call duplicate() the material (or any other resource type) I want to tweak individually and dynamically re-assign it to all instances. This method always works. It's like this:
var m: ShaderMaterial = my_material.duplicate() # This is the key line(!!!!!!!!!!)
m.set_shader_parameter( "parameter_a", value_a )
m.set_shader_parameter( "parameter_b", value_b )
mesh_instance.material_override = m
What I'd do is I'd make a export with a material I wanted to use and assigned it via calling duplicate() in _ _ready() _ method. Then I'd have completely independent material instances in all the meshes.
@export material var my_material: ShaderMaterial = preload( "res://my_material.tres" )
func _ready():
var m: ShaderMaterial = my_material.duplicate()
material_override = m # Here it is material override just for illustration. You can assign it to surface_material or any other place.
If you do this, you'll only rarely recall local_to_scene flag in nightmares...