Closed SubtleSanity closed 3 years ago
SubtleSanity, This was a very good catch, and I have a PR coming up to fix this issue. Using the testproject you provide I did determine a flaw in my original design with the SceneEventData being a singular instance. The fix will include a SceneEventData pool that will avoid this type of issue. Basically, since your scene was so small the server was able to send an event back to the client before the client was finished loading and the SceneEventData (singular) instance was being overwritten.
Thank you for your submission and taking the time to put the project together, it helped me track this down very quickly! 🥇
Describe the bug Exception thrown on client when a network scene load is performed
When the client loads the scene (after the server calls for a networked scene load) it adds an entry in a dictionary that links the scene instance handle at the client to the scene instance handle at the server. This throws an exception as the server scene handle is already present in the dictionary. It appears that when the server performs a scene load it is sending the wrong handle to connected clients (it might be sending the handle for the current scene instead of the newly loaded one?).
Some notes:
Stack trace of error:
To Reproduce
See sample project attached at the end You need to run two copies, so either duplicate the project or build it.
Run the project Click "Start as Server"
Run the project Click "Connect as Client"
On the server project Click "Load additive scene"
Observe error thrown on client project
Note that the error does not occur if you start the server project as 'host' rather than 'server', and that it only happens for scene loads that are initiated while the client is connected and not for scene loads that were initiated before the client connects.
Environment (please complete the following information):
Additional context
TestProject.zip Made in 2021.1.16f but shouldn't be version dependent. Make sure you run from StartScene