Wait until the RPC method done

Hi and Thanks for this awesome plugin!

I'm new to Photon and I want to change my ready game to multiplayer type. Everything is going well, but just one problem where some of my old methods return value. When Implement them to RPC methods, how should be waiting for that value to be ready?

I know it's not related to Photon, but hope someone may helps me! I'm really getting confused!

Thanks in advanced.

Comments

  • Its not quite clear what you mean by "Implement them to RPC methods"
  • Sorry for being late.


    Something like this:
            public void destroy__()
            {
                 item_pv = GetComponent<PhotonView>();
                if (item_pv)
                {
                    item_pv.RPC("_DestroyRPC_1", RpcTarget.All, item_pv.ViewID);
                }
            }
    
            [PunRPC]
            private void _DestroyRPC_1(int object_id)
            {
                if (item_pv && item_pv.IsMine) 
                    PhotonNetwork.Destroy(PhotonView.Find(object_id));
               
                Destroy(gameObject);
            }
    

    In this example everything is simple.No return value is required.


    My problem is Something like this:
    //old method
     IEnumerator EquipItemSystem(EquipPoint equipPoint, Item item)
            {
    ...
                  equipedObject = EquipEquipment_(item, equipTransform.position, equipTransform.rotation, equipTransform);
    
                  equipedObject.equipPoint = equipPoint;
                  equipPoint.equipmentReference.item = item;
                  equipPoint.equipmentReference.equipedObject = equipedObject.gameObject;
                  equipPoint.onInstantiateEquiment.Invoke(equipedObject.gameObject);
    ...
    }
    




    In the example above, I need the return value of "EquipEquipment_" :
          protected  Equipment EquipEquipment_( Item item, Vector3 position, Quaternion rotation, Transform parent = null)
            {
                Equipment equipment=null;
    ...
                pv.RPC("RPC_EquipEquipment_", RpcTarget.All, pv.ViewID, item.id, position, rotation.eulerAngles,   parent.name);
    
    ....
    
                  return equipment;
                  }
                return null;
            }
    

    As you know, the method must return the "equipment".But how do I force the process to wait for the "RPC_EquipEquipment_" to be done?
    How can I handle such a situation?