OnDisconnectedFromPhoton does what ?

Options
hi im making a vr multiplayer shooter via pun and im looking for what OnDisconnectedFromPhoton does , let me explain if i disconnect from the server it magically cleans up evrything whit my player id and i want to do that whitout disconnecting i mean it cant be that hard if pun does it automatic when i disconnect when i start the game it connects instantiates my player and then instantiates my head , gun and jetpackcontroller but i cant parrent these 3 items to my player or the syncing in open vr stops working so im searching for a way to simply destroy evrything that has the same id as my player whitout hardcoding anything to the player because the objects and player change allot during the playtime and its starting to drive me nuts

Best Answer

Answers

  • DataFlo
    Options
    uhm how do i get the owner id , i tryed PhotonNetwork.DestroyPlayerObjects(1); wich delets evrything correct if im the first in the server and my owner id is 1 but if i shoot player 2 or 3 or 4 etc it dosnt work i tryed setting it to 0 but then it works for noeone so is there like a way to grab the owner id of a atached photonview and store it in a int ? its a bit confusing

    edit : i found out how to delet evrything whitout a thousand steps now finaly after working for moths on it and i wanted to share the awnser wich is under the local despawn i simply post on the ismine side wich looks now like this
    if (GetComponent().instantiationId == 0){
    Destroy(gameObject);}
    else {
    if (GetComponent().isMine){
    if( gameObject.tag == "PlayerOrange" ){
    photonconnect pc = GameObject.FindObjectOfType();
    pc.respawnTimer = 5f;}
    PhotonNetwork.Destroy(gameObject);

    PhotonNetwork.DestroyPlayerObjects(this.transform.GetComponent().OwnerActorNr);

    //this last line does it for me all the other owner id instantiation id and the hundrets of ways todo this would not work but this does and its simple and selfcontained hope this helps someone eles going trough the same struggle and its like the only way that steamvr allows me to delet the synced hand and head´s
    because it cuts the connections seperates and stops the running rpc´s and all in one command and it dosnt care for wich team the char is on only wich computer its running off .....im so happy right now ^^