PUN Request: skip pooling when using PhotonNetwork.Instantiate and PhotonNetwork.Destroy.

Ascendance Games

New member
The PunObjectPool script is needed by many features of the PUN addon, but I'd like to exclude my character from pooling and allow the standard behavior of PhotonNetwork.Instantiate, and PhotonNetwork.Destroy.

The character is breaking when being retrieved from the pool after use.
 
Right now this will take modification within PunManager.SpawnCharacter, but I can add the option to the next version.
 
Right now this will take modification within PunManager.SpawnCharacter, but I can add the option to the next version.
I'm using my own spawner which uses photon network.inatantiate, but the pun addon overrides default spawn behavior. As well standard destroy behavior, it's pooling the character rather than destroying.
 
I made a small hack that seems to destroy while avoiding the pool. There may still be some instantiation garbage being created by the pool overriding instantiation behavior though.

Code:
        public void EventDestroy(PhotonView view)
        {
            if (view == null)
                return;

            RaiseEventOptions eventOptions = new RaiseEventOptions
            {
                Receivers = ReceiverGroup.Others,
                CachingOption = EventCaching.DoNotCache
            };
            SendOptions sendOptions = new SendOptions { DeliveryMode = DeliveryMode.Reliable };
            PhotonNetwork.RaiseEvent(PhotonEventIDs.ObjectDestruction, view.ViewID, eventOptions, sendOptions);
            //Destroy locally.
            Destroy(view.gameObject);
        }
 
Top