PUN2: Bug in PhotonView ID

Hi,
I've found a bug in PhotonEditorUtils.IsPrefab()
It seems that the new code UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetPrefabStage(go) under UNITY_2018_3_OR_NEWER is not working as expected:

All PhotonViews on all prefabs have been given a fixed ID. On startup photon complains about duplicated PhotonView IDs. (In the same scene - there is no scene loading process)

I've removed the preprocessor directive and used EditorUtility.IsPersistent(go). Now it works again.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @NickNack84,

    Thank you for choosing Photon!

    Our tests show that PhotonEditorUtils.IsPrefab works as expected on 2017.4.7f1, 2018.4.11f1 and 2019.4.16f1.
    What PUN 2 version are you using?
    Which Unity version are you using?
    Could you give us minimal repro steps for this bug?
  • NickNack84
    edited February 2021
    Hi,
    Unity: 2020.1.17f
    PUN2: 2.27

    I've updated PUN1 to PUN2 successfully.
    Then (in play mode) I got about 100 errors: "Duplicated PhotonView ID." Because the PhotonViewId was set in the prefab to a specific value. If you instantiate this prefab more than once, then you have a duplicated PhotonViewId of course.
    Then I realized that PhotonEditorUtils.IsPrefab returns always false for every prefab. (Maybe because of UnityEditor.Experimental.SceneManagement...) - In my case, at the moment only EditorUtility.IsPersistent is working properly.