override public void PickUpObject(PickUpSystem WhoPicked) { health cmp = WhoPicked.gameObject.GetComponent <health>(); Debug.Log(WhoPicked.name + "Picked Up HP"); if (cmp.hp + hp <= cmp.maxhp) { //cmp.Ammo[weaponid] += numberofammo; cmp.Heal(hp); //WhoPicked.Global.PickUps.Remove(this); if (photonView.IsMine) //Destroy(this.gameObject); { PhotonNetwork.Destroy(this.gameObject); //Destroy(this.gameObject); } else // Вроде и так работает, но на всякий { //photonView.RequestOwnership(); //PhotonNetwork.Destroy(this.gameObject); Debug.Log("transfering ownership from " + photonView.Owner.NickName); //photonView.RequestOwnership(); //photonView.TransferOwnership(PhotonNetwork.LocalPlayer); //Debug.Log("owner is now " + photonView.Owner.NickName + " / should be " + PhotonNetwork.LocalPlayer.NickName); photonView.SetOwnerInternal(PhotonNetwork.LocalPlayer, PhotonNetwork.LocalPlayer.ActorNumber); Debug.Log("owner is now " + photonView.Owner.NickName + " / should be " + PhotonNetwork.LocalPlayer.NickName); PhotonNetwork.Destroy(this.gameObject); } } else { hp -= cmp.maxhp - cmp.hp; cmp.Heal(cmp.maxhp - cmp.hp); } }