Problem about the destruction of scene objects

Hello,

I'm new with Photon, I use the 1.18 version on the Photon Cloud and I encounter some problems with scene objects.

All the treatments of these scene objects is made by the master client and are correctly destroyed during its execution.

In the spawner script :
if(PhotonNetwork.isMasterClient) {
...
GameObject ia = PhotonNetwork.InstantiateSceneObject("IACharger", spawnPosition, Quaternion.identity, 0, null);
...
}

In the object script :
if(PhotonNetwork.isMasterClient) {
...
PhotonNetwork.Destroy(photonView);
...
}

But when I connect a client, all the scene objects are in its scene even the ones destroyed before the connection.

Did someone knew this problem and have a solution, or is there something I could have forgotten to make it works ?

Thanks for your answers.

Lelkor

Comments

  • Hello everyone,

    I don't know why, but this problem is resolved by sending the gameObject in the PhotonNetwork.Destroy method.

    PhotonNetwork.Destroy(gameObject);

    But this is strange in the documentation, the Destroy method of PhotonNetwork takes a PhotonView in argument, and I don't have any error sending the gameObject for the scenes objects.

    Well, my problem is resolved.

    Lelkor
  • I'm sorry this is/was a problem for you. I've taken a look at the Destroy() code and refactored it quite a bit for the next release.
    Please consider updating to PUN 1.20, too. It's not a big difference for you but we always gradually improve things over time.