From e1dc0e7345f1a2af361dbde848078fe23828c713 Mon Sep 17 00:00:00 2001 From: melancholytron Date: Sun, 1 Mar 2026 12:33:49 -0600 Subject: [PATCH] Fix shared material bug: duplicate material per webcam quad instance Godot 4 shares sub_resource materials across scene instances by default, so all 3 camera quads were showing the same (last updated) texture. Duplicating the material in _ready() gives each instance its own texture. Co-Authored-By: Claude Opus 4.6 --- scripts/webcam_display.gd | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/webcam_display.gd b/scripts/webcam_display.gd index 58d4190..1b254a1 100644 --- a/scripts/webcam_display.gd +++ b/scripts/webcam_display.gd @@ -18,9 +18,12 @@ var _has_received_frame: bool = false func _ready() -> void: - # Get or create the material + # Get or create the material — duplicate to ensure each instance has its own _material = material_override as StandardMaterial3D - if _material == null: + if _material != null: + _material = _material.duplicate() as StandardMaterial3D + material_override = _material + else: _material = StandardMaterial3D.new() material_override = _material