Closed MrGadget1024 closed 5 years ago
@MrGadget1024 can you try with latest master again? fixed another sceneid issue today.
No change in behavior with latest master this morning. Updated linked repo project linked above.
A while back when Paul fixed Additive the last time, I had to call NetworkServer.SpawnObjects()
after loading additive scenes on the server, and I had to call ClientScene.PrepareToSpawnSceneObjects()
on the client after it loaded an additive scene.
NetworkServer.SpawnObjects()
throws a flood of errors so I commented that out in the server. The additive scene on the server appears to load up fine.
ClientScene.PrepareToSpawnSceneObjects()
doesn't seem to make any difference on the client. The scene is loaded additive when it should, but everything is immediately visible even though I'm out of range of the proximity checkers of the sub-scene objects.
Updated repro to latest Mirror
taking a look at this now. last open bug, here we go..
going to share my findings here along the way. you can call LoadSceneAsync in OnStartServer directly, no couroutine / yield magic needed
same for UnloadScenes
OfflineScene & OfflineGUI seems to be unnecessary. please avoid that in next bug report :)
SceneLoader.cs simplified:
please try to keep it as simple as possible next time. this takes a lot of time to dig through and understand
looks like LoadSceneAsync doesn't trigger NetworkScenePostProcess, which is why the additively loaded scene objects don't contains the scene hash. that's a problem.
that is also the reason why they aren't being disabled on load
onpostprocesscene is actually called. but SceneManager.GetActiveScene().name is MainScene each time because the additively loaded scene isn't the main scene. hmm
host mode of the example seems to load subscene twice when walking into it, because server already loaded it in onstartserver once. will avoid host mode
got it working in my tests @MrGadget1024 . we will need two fixes:
this definitely works. I will add this to master after some more tests. afterwards we'll have to figure out a more consistent way for PrepareToSpawnSceneObjects and SpawnObjects. ideally one way that works in all cases.
fixed in master. thanks for repro project mrgadget.
:tada: This issue has been resolved in version 1.4.1 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Please retest with repro attached to this comment
:tada: This issue has been resolved in version 1.4.2 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Unity 2018.3.8 / Mirror 2184 Repro Project Attached
There's a trigger zone in the middle of the Main Scene that's Server Only with a Zone Handler script that fires a TargetRpc to player that enters the zone to load the sub scene. There's a ZoneVisualizer with a semi-transparent material so you can see where it should trigger.
There are 4 networked objects with proximity checkers in the corners of the Main scene...they have semi-transparent spheres showing their ranges. These work correctly if you move the player toward them.
1st Bug There are the same 4 networked objects with proximity checkers in the middle of the SubScene. These should be hidden when the SubScene loads until player gets close to them...instead they all are shown immediately when the SubScene is loaded.
2nd Bug If you run LAN server in editor and LAN client as built, the SubScene content never appears in the client, despite log messages that say it's loaded, even when player gets to the scene center where it'd be right among the cluster of prefabs there.
MirrorAdditiveTest.zip