ClientSim doesn't work with Player Objects when Reload Domain disabled
tracked
naqtn
If the Unity project settings
Reload Domain
is disabled, ClientSim doesn't properly handle Player Objects, causing exceptions and stopping work.Repro
- Start Unity. Create a scene. Add VRCPlayerObjectcomponent(s).
- Enable Play Mode Optionsand disableReload Domain(via Unity menu > Edit > Project Settings > Editor > Enter Play Mode Settings)
- Press the Play button to start ClientSim (it will work normally at the first launch). And exit play mode.
- Press the Play button again. Then, MissingReferenceExceptionoccurs (see attached). And it doesn't work correctly anymore.
Version
World SDK 3.7.5
Analysis
Clientsim caches the Player Objects in
ClientSimNetworkingUtilities._playerObjectList
. And it depends on the reloading to initialize it. It should be initialized when starting the simulation.Snipping from the log for searching
MissingReferenceException: The object of type 'VRCPlayerObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
VRC.SDK3.ClientSim.ClientSimPlayer.SetupPlayerPersistence (VRC.SDK3.ClientSim.IClientSimEventDispatcher eventDispatcher, VRC.SDK3.ClientSim.IClientSimUdonEventSender udonEventSender, VRC.SDK3.ClientSim.IClientSimBlacklistManager blacklistManager, VRC.SDK3.ClientSim.IClientSimUdonManager udonManager, VRC.SDK3.ClientSim.IClientSimSyncedObjectManager syncedObjectManager, VRC.SDK3.ClientSim.IClientSimPlayerManager playerManager) (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Runtime/Player/ClientSimPlayer.cs:198)
Log In
Pokerface Cactus
After some digging i found that the only issue here is that when the domain is not reloaded _playerObjectList; is not cleared out. all that's needed to fix this problem is to ensure that _playerObjectList; is cleared upon exiting play mode.
Myrkur
Pokerface Cactus the issue should have been fast tracked since a similar issue was already fixed with the same root cause
StormRel
tracked