Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

Unparent an object while PhotonNetwork.connectionState == ConnectionState.Disconnecting

$
0
0
I have a player character who sits on a block. When the player character is sitting on a block he is the parent of the block. This is so that when I move the player character the block follows him exactly. When I disconnect from the game the player character (not scripted disconnect, but forced close of the game window), I need the block to stay on the game. As the block is a child of the player character it is being destroyed along with the player character. I have tried to unchild the block when the player character disconnects using



if (PhotonNetwork.connectionState == ConnectionState.Disconnecting) {

GetComponentInChildren<CheckForPassenger> ().DitchParentonDisconnect ();

PhotonNetwork.Destroy (gameObject);


}

but this is not working as I expected it to.

The block is originally a part of the scene and has a photonview. I do not instantiate the block. It is already part of the scene.

The block is still destroyed with the character. Any advice would be great ;)

Viewing all articles
Browse latest Browse all 15755

Trending Articles