0

I use High-level API and I have a SceneA and SceneB.

SceneA has a couple spawned objects. After a new connection, each client receives objects list and spawn it.

But when I change networkScene A to SceneB and go back I see no objects on SceneA that were be rendered before.

Is there any solution how to get back to SceneA and refresh scene objects according to network SceneA instance?

In the SceneA I use something like this:

    public override void OnStartServer()
    {
        SpawnObjects();
    }
xercool
  • 883
  • 1
  • 8
  • 24
  • Have you tried using the following `DontDestroyOnLoad()` that could be the issue. Read more about it - https://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html – aidangig Sep 14 '18 at 19:56

1 Answers1

0

Keep in mind that networked objects SHOULD be spawned every time you load the scene.

So if they are not spawning "automatically" is probably that you don't set any logic to do that.

So the workflow should be something like:

  • SceneA have a prefab that SPAWNS objects when Starts -> Spawner

  • When the players connect to the scene, the Spawner will be created and in his Start() function will spawn stuff.

  • When you move to the sceneB, if you do not set to DonDestroyOnLoad() the previous objects, will dissapear on B

  • But if you move back to A again, as the game is "creating" the scene A again, the spawner will be created again, and spawn the stuff again.

Lotan
  • 4,078
  • 1
  • 12
  • 30