1.7 bug PHOTON ERROR: This should never be possible:

In new version 1.7 i get error when i use

PhotonNetwork.Destroy(player); and after less than in second PhotonNetwork.Instantiate(PlayerPrefab);

PHOTON ERROR: This should never be possible: Two PhotonViews with same ID registered? ID=1001 Player(Clone) and LocalGuest 78281

Comments

  • terrible bug! i have to downgrade to 1.6 because of that
  • Which player are you destroying? Are you using autocleanup, too?
    And: Which Unity version are you using?
  • Also, what Unity version are you using?
    This could be because of a viewID being saved to a prefab. If so, this should fix it:

    Add "#if !UNITY_3_5 sceneProp.prefabOverride = true; #endif " to PhotonViewInspector.cs line 55

    The code should then look like this:
    if (sceneProp.isInstantiatedPrefab && !sceneProp.prefabOverride)
            {
                //Fix the assignment
    #if !UNITY_3_5
                sceneProp.prefabOverride = true;
    #endif
                sObj.ApplyModifiedProperties();
    

    After this patch, make sure to open your prefab in the inspector to have this do it's work.
  • friuns
    friuns
    edited January 2012
    unity version 3.4.2f3 PRO
  • Tobias wrote:
    Which player are you destroying? Are you using autocleanup, too?
    And: Which Unity version are you using?
    i destroying self, then respawn it, no autocleanup
  • line 76 for me, no effect


    if (sceneProp.isInstantiatedPrefab && !sceneProp.prefabOverride)
    {
    //Fix the assignment
    #if !UNITY_3_5
    sceneProp.prefabOverride = true;
    #endif
    sObj.ApplyModifiedProperties();

    //FIX THE EDITOR PREFAB: set it to 0
    GameObject pPrefab = (EditorUtility.GetPrefabParent(mp.gameObject) as GameObject).transform.root.gameObject;
    List<Component> views = FindAllComponents(typeof(PhotonView), pPrefab.transform);
  • I made sample for you http://csportable.com/Game/Photon Unity Networking.zip
    Press "Die and Spawn" button in your example and you get this error
  • any fixes yet? did you tried my example?
  • I tried to have a quick look yesterday, but since you only uploaded the "Assets/Photon Unity Networking" folder, all assets lost their links (so every prefab etc need to be assigned again).
    Could you please zip a complete project folder? You can still remove your own assets as long as both the Assets/Photon Unity Networking and Library/ folders are in the zip.

    Exporting as a package should also work.
  • friuns
    friuns
    edited January 2012
  • Thanks this repro works.
    Looks like it doesn't happen if there is a pause in between the destroy and spawn. My first suspicion is Unity's GameObject.Destroy which I believe only executes -after- the current frame ends.

    As a workaround for your game you can yield 1 frame before calling spawn, while we fix this.

    BTW: you can remove the link (as it includes your appID!).
  • i will check it again but i think its must be at least on second between Instanciate and Destroy (depends on ping i think) or this error appears. I will make another sample if i'm right

    its never happened in 1.6 and Unity Network btw
  • Not in 1.6? Oh thanks, thats good to know!
  • yes in 1.6 this error not appear.

    in 1.7 when i skip 1 frame error not appears. But still this bug can cause errors in my game. I will use 1.6 while this not fixed.
  • this error also occurs in PhotonNetworkUpdate even if you skip one frame, when many players respawn at same time, like in Counter Strike, so please fix this ASAP
  • In 1.6 allocated viewIDs are not properly removed, this was fixed and this is why the error you reported started to appear in 1.7.
    However the 1.7 error is because of Unity's OnDestroy being executed only at the end of a frame, so if you destroy & instantiate in the same frame that caused a conflict.

    All issues have been solved and will be in the next release (1.8)
  • good but will be 1.6 compatible with cloud service?
  • I believe it still works doesnt it? Furthermore we might submit 1.8 tomorrow already.
  • yes it works, cool thanks)