PUN2 equivalent of PhotonNetwork.UnAllocateViewID

We're making a PS5 version of an old PS4 game and we need to update it's PUN code to PUN2. We already have a stable PUN2 version of our networking code so it's easier to update based on that than to convert it to FUSION.

I've run across a reference to PhotonNetwork.UnAllocateViewID which doesn't appear in our already converted code and can't find anything on this in the docs.

We do manual instantiation so using the Photon network destroy is not an option. I did find a reference to setting the view id to 0 but wasn't sure if this is the correct way.

When we destroy a manually instantiated game object, how should we correctly free up the view id?

Thanks,

Reggie

Best Answer

  • Tobias
    Tobias admin
    Answer ✓

    It is correct to simply set the PhotonView.ViewID back to 0 to free it.

    The lookup for allocations just checks the currently used ViewIDs in a dictionary, which is updated when you set the ViewID property.

Answers

  • Tobias
    Tobias admin
    Answer ✓

    It is correct to simply set the PhotonView.ViewID back to 0 to free it.

    The lookup for allocations just checks the currently used ViewIDs in a dictionary, which is updated when you set the ViewID property.

  • Thanks!