Quick answer: Godot 4 shader instance uniforms shared across mesh instances? Default uniforms are global - declare with `instance` keyword for per-instance values.
Two enemies share a material. Setting energy on one tints both.
Use instance uniform
instance uniform float energy = 1.0;Per-instance storage. Set via mesh_instance.set_instance_shader_parameter("energy", value).
Or create material copies
Older Godot versions: material.duplicate() per instance. Heavy; gives full isolation.
Check renderer support
Instance uniforms require the Forward+ renderer. Compatibility renderer falls back to per-material values silently.
“Per-instance state needs explicit declaration in the shader.”
For projects with many instanced characters, the instance-uniform pattern is essential. Material duplication scales poorly.