Swapping between objects in different scenes.

Hi.
Can somebody help me with simple JS script.

  1. I have two objects with Character controllers attached to them.
  2. I swap between them with Input.GetKeyDown
  3. When selected one reaches one end of screen I reload it in new Scene.

Here is my issue.
When I go back to previous scene with the selected one I don’t know how to keep the one that I left in previous scene in the same position as it was before I loaded new scene.

I tried DontDestroyOnLoad but then both objects load in new scene.
I’m thinking that I need to keep DontDestroyOnLoad and somehow add rendering and or active.

Simple example.

  1. I have two people - Boy and Girl both standing in center of room.
  2. (selected) The Girl goes to sit down at table. (Selected) Boy goes to other room.
  3. New scene loads with Boy only in new room
  4. The Boy goes back to previous room and the Girl is still siting at the table.

I’m also trying to make it work so that even if they are in separate rooms I can still swap between them which involves reloading scenes and their current positions.

Any help is appreciated.
I spent days trying to make it work.

You could use an auxiliar gameObject that holds the information of both with a two public transforms or something like that. Then you should apply to this “manager” or “recorder” the DontDestroyOnLoad, and make it pass the information to the specific character.

Other option would be, of course, not using scenes. Scenes don’t load so fast when they get complex and if you want a soft character-to-character flow, you could just asume a big scene or use XML, which are much faster loading than scenes. Don’t ask me how to use XML files to save/load, I have no idea… sorry about that empty advice but I’m sure you could find a lot of information once you know this.

Good luck.