Photon Transform View synchronize options keep getting reset

Hi,
I'm using PUN 2.16 and I have a bunch of prefabs with Photon Transform View components on them. I turn off sync position and turn on sync scale, do some work in unity, maybe do a build, and go back to the prefabs and find that the sync options have been reset to position on and scale off. This has happened numerous times now. I'm using Unity 2019.3.1.

Any suggestions?

Thanks

Comments

  • PUN does not reset these values. Make sure Unity stores the changes in the prefabs.
    Any way to repro this? Any guess at which percentage of changes this happens?
  • I ended up removing the component and do all the syncing in OnPhotonSerializeView
  • S_Oliver
    S_Oliver ✭✭✭
    Sounds like you didnt saved thoose changes on the Prefab.
  • Some additional notes.
    I'm having the same problem with a new 'Use global values' flag I added to the Photon Transform View and its editor class.
    Test:
    - set the sync option to true
    - 'save' and 'save project' in unity
    - git status
    nothing to commit (nothing was saved)
    - close unity and restart
    - setting has reset to false
    I believe this must be a Unity problem (2019.3.13f1) because I've checked the photon source and they definitely don't reset any of these values. I will try to make a minimal repro and report it on Unity forums.
  • In the meantime:
    void Start()
        {
            // NOTE:
            // Unity or the PhotonTransformView do not save the editor tick boxes for these sync settings
            // so I'll have to manually set them here...
            PhotonTransformView ptv = GetComponent<PhotonTransformView>();
            ptv.m_SynchronizePosition = true;
            ptv.m_SynchronizeRotation = false;
            ptv.m_SynchronizeScale = false;
            ptv.m_SynchronizeGlobal = true;
        }
    
  • pjbaron wrote: »
    In the meantime:
    void Start()
        {
            // NOTE:
            // Unity or the PhotonTransformView do not save the editor tick boxes for these sync settings
            // so I'll have to manually set them here...
            PhotonTransformView ptv = GetComponent<PhotonTransformView>();
            ptv.m_SynchronizePosition = true;
            ptv.m_SynchronizeRotation = false;
            ptv.m_SynchronizeScale = false;
            ptv.m_SynchronizeGlobal = true;
        }
    

    This worked for me thanks! Hopefully, some sort of explanation will come someday. Was making a game where changing the scale was the main game mechanic and I have been tearing my hair out figuring out why synchronize scale kept resetting.
  • I believe this was a problem in the PhotonTransformViewEditor.cs where those values were set directly using the instance values rather than using SerializedProperty. It was missing a SetDirty call on changes.

    The latest Pun2 has had that component reworked, and shouldn't have that problem. Let me know if you experience any issues with the latest version.