Loading new scenes: issues and questions
Hey all,
So, since I've no way of knowing much better, when I want my players to jump to a new scene, I send out an RPC that has them all load a new level via Application.LoadLevel(). However, I'm getting a bunch of warnings on both sides saying:
OnDestroy for PhotonView View (0)2001 on Local player but GO is still in instantiatedObjects. instantiationId: 2001. Use PhotonNetwork.Destroy(). Loading new scene caused this.
It seems to be mad at me for loading scenes this way, but I'm not sure how to fix it or what to do differently. Also, since each player is loading the scene at a different rate, there's more room for error with RPCs and syncing (I've had inconsistent issues when loading new levels together). Is there any way to have the players load the scene and wait for everyone else to enter? How do I rid myself of those weird warnings? How should I be loading scenes if not this way?
Thanks!
So, since I've no way of knowing much better, when I want my players to jump to a new scene, I send out an RPC that has them all load a new level via Application.LoadLevel(). However, I'm getting a bunch of warnings on both sides saying:
OnDestroy for PhotonView View (0)2001 on Local player but GO is still in instantiatedObjects. instantiationId: 2001. Use PhotonNetwork.Destroy(). Loading new scene caused this.
It seems to be mad at me for loading scenes this way, but I'm not sure how to fix it or what to do differently. Also, since each player is loading the scene at a different rate, there's more room for error with RPCs and syncing (I've had inconsistent issues when loading new levels together). Is there any way to have the players load the scene and wait for everyone else to enter? How do I rid myself of those weird warnings? How should I be loading scenes if not this way?
Thanks!
0
Comments
The easiest solution is to set this in your mainmenu/preloader:
PhotonNetwork.automaticallySyncScene = true;
This will make sure clients always use the same level as the masterclient.
Also, for level loading, use:
PhotonNetwork.LoadLevel( .. );
This will automatically take care of pausing and resuming network messages.
Leepo & Exit Games: You guys have made a 5-star plugin! I am continually impressed with how flawlessly PUN works with Unity, and how simple the interface is.
One note: you should probably add this fix to the documentation so that new users don't stumble on the same errors that we did. I noticed that your intro page doesn't even include PhotonNetwork.LoadLevel() (let alone the level sync), it still mentions the messagequeue disable technique that was replaced by LoadLevel().
http://doc.exitgames.com/photon-cloud/P ... #_messageQ
Good point about the doc update. I will take care of that soon.
Also one more thing: searching for Photon documentation from Google hasn't been very helpful because Google doesn't return accurate results. This makes me think that maybe your website isn't very friendly with Google's web crawlers. I haven't tried any other search engines though.