[BUG] PunMultiplayerAddOnInspector.SetupCharacter: Running SetupCharacter more than once leaves PhotonView Observed Components with an empty element

echtnice

Member
Hi,

when I run PunMultiplayerAddOnInspector.SetupCharacter through the PUN AddOns tools multiple times on the same character,
the PhotonView ObservedComponents array is of Length 4 and one array element is uninitialized.

This is because SetupCharacter deletes the AnimatorMonitor (which was listed in the ObservedComponents array) and than recreates an PunAnimatorMonitor.
We could not delete AnimatorMonitor if it's a PunAnimatorMonitor like below, which works for me.

PunMultiplayerAddOnInspector.SetupCharacter256:
Code:
        private void SetupCharacter()
        {
            if (m_Object == null) {
                return;
            }

            // Remove the single player variants of the necessary components.
            var animatorMonitor = m_Object.GetComponent<AnimatorMonitor>();
            if (animatorMonitor != null && !(animatorMonitor is Character.PunAnimatorMonitor)) {
                GameObject.DestroyImmediate(animatorMonitor, true);
            }

Thanks!
 
Top