I have a few cubes that can be carried across scenes by the player.
Currently:
- When player pick up cube - move cube to persistent scene
- if released, check if original scene is loaded - move cube to original, else move to another scene(not persistent)
- if no other scene beside persistent scene is loaded (probably never the case by design) then cube stays in persistent scene
Problem:
- Cube duplicates when moving back to original scene, tried to use instance and destroy if there are replicates. This works with one moveable cube, but can’t find a way to work with multiple.
- I tried to create a list to reference the moveable cubes but I don’t know how to match two of the same cubes when a scene unloads then reloads again…
Example:
3 cubes in original scene
Player moves out of original scene and cube is held in persistent scene temporarily until player releases cube.
Player moves back to original scene with cube in hand, but a duplicate spawns because it doesn’t know it already exists.
What should happen is Cube1 should destroy itself when the same cube held by the player is moved back into scene.
OR if cube1 is in another scene, then also destroy itself. In other words if cube1 has left original scene in any way, then it should always destroy itself when player comes back.
I’m stuck trying to identify cube1 globally, because if I can tell the game that this object exists already somewhere in game, then it’ll apply to every other object that can be moved across scenes.
I’m trying not to leave a cluster of objects in persistent scene because I don’t know how many objects can be carried in the future, and since persistent scene always loads, it’ll cluster very quickly if say I pick up 1000 cubes and never touch 900 of them. Thank you.




