Unparent an object while PhotonNetwork.connectionState == ConnectionState.Disconnecting
Options
barry100
✭
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
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
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
0
Comments
-
Hi barry100,
is there just one block in the scene? Maybe then you should not re-parent it but allow the matching player to change the block's position via function call.0