Godot Version
4.3
Question
I just created a little project to reproduce a problem that I am searching a solution for.
I have a simple scene that is a Sprite2D with a CanvasTexture and diffuse texture assigned, the resource_local_to_scene is set to true for the Sprite2D’s texture:
Then I have another simple scene that has the sprite scene instantiated, and it duplicates the instance and replaces the texture of the duplicate scene with another texture:
extends Node
@export var texture2: Texture2D
@onready var sprite: Sprite2D = $Sprite
@onready var sprite_duplicate: Sprite2D = sprite.duplicate()
func _ready() -> void:
add_child(sprite_duplicate)
sprite_duplicate.texture.diffuse_texture = texture2
Now the problem is that when running the scene the texture is replaced both in the new scene and in the old one, the obect id is the same in both places as you can see in the remote view here:
Am I doing something wrong?