Best way to manage multiple duplicates of one scene

Godot Version



I have multiple SubViewports, each with a duplicate of the same scene. This works okay, but if I want to move a node, I have to move it separately for each copy of the scene. Is there a better way to do this so that if I move a node in one copy, it moves in all the copies?

Here is what the structure of the game looks like:
Screenshot 2024-05-14 115225

Here is the code I am using to move the node across all three copies:

extends Node
@onready var remotes = Controllers.remotes
@onready var players = [
func _process(delta):
	for player in players:
		player.global_position = Vector2(player.global_position.x+10*delta,player.global_position.y+10*delta)

Thanks in advance. :slight_smile:

if you want same scene with duplicates to do the same action, you will want to move them with Global Event Bus Signal, with the scene already subscribed/connect to the movement signal
read here how to setup the Global Event Bus:,Global%20Event%20Bus,-In%20GoDot%20we

how would you move the player or Testscene?

Unique names could help you out, seems alright to me though. Since Testscene is already an instanced scene I’m not sure what friction you are encountering for each “copy”.

If you do end up using Unique names, make sure to call them from a parent script, the root node game would work best.

1 Like

That certainly simplifies things a lot. Not quite what I had in mind, but it should certainly shorten the code. I guess I’ll just continue to loop through each scene copy then. Thanks :smiley:

1 Like