Errors on network-destroying a disabled game object

Options
82apps
82apps
edited January 2015 in Photon Unity Networking (PUN)
I noticed that I'm getting some errors when I call PhotonNetwork.DestroyAll() when some of my photon-view-equipped objects are disabled. The error in question is "Failed to 'network-remove' GameObject because has no PhotonView components".

This is happening because NetworkingPeer.RemoveInstantiatedGO() looks for PhotonViews with this line:
PhotonView[] views = go.GetComponentsInChildren<PhotonView>();

This doesn't iterate through disabled game objects, therefore it isn't able to find the photon view in this situation.

I'm wondering if it's appropriate for this line to be updated as such:
PhotonView[] views = go.GetComponentsInChildren<PhotonView>(true);

...which will allow it to find the photon views on the disabled game objects - or if I shouldn't be disabling these networked objects in the first place. Thanks for any guidance.

Comments

  • Tobias
    Options
    Good catch!
    This is something we didn't try and use so far. The fix you propose sounds good, so I think it will make it into the next PUN release.
    I think you should have no difficulties with this and can use the fix right away.

    Thanks for finding AND solving the bug :)
  • Bren
    Options
    It's seven months later and this code remains the same.
  • Tobias
    Options
    Sorry. This topic wasn't ignored but got "lost in translation".
    I took a note which lacked the part "... in RemoveInstantiatedGO...". Due to that, I was thinking about including disabled GOs in ALL places and didn't want to do this (bigger) change.
    In RemoveInstantiatedGO, it should be ok to include disabled objects and I can include it in the next update.
    Finally.