Send multiple data via RPC to limit message on Photon Cloud

Options
Hi every body !

I would like to know if it's possible to sent multiple data with RPC?

I'm working on a 2d game like a mmorpg on Android, and i have done a little system to movement and send RPC to know the movement of other player. it's working but sometimes the exact position can change and i need to send the new position to lerp to this position in the same time than other RPC. but i'm very limited about the number of message send/s

I know how RPC is working, but at this moment i'm only use to send one INT, or string.

I want to send 2 int in the same method in one RPC, or a int with a vector 2.

So if someone can tell me if that is possible and how can i do i'll really appreciate ! :)

Thx a lot, and have a good day ! :)

Comments

  • Hi @redskry,

    please take a look at the RPC and RaiseEvent guide. The RPC example at the top of the page will show you, how things work with multiple parameters.
  • redskry
    Options
    Thanks for you're anwser ! I have read this guide but i'm don't undertand enought to success it :/

    Can i have a simple exemple like send via RPC the array "test[]", with test[0] = 1, and test[1] = 2?

    Thx again for you're help!
  • int[] data = new int[] { 1, 2 };
    photonView.RPC("Method1", PhotonTargets.All, data);
    photonView.RPC("Method1", PhotonTargets.All, new int[] { 1, 2 });
    
    photonView.RPC("Method2", PhotonTargets.All, data[0], data[1]);
    Each of them does (most likely) the same, 'Method1' has an int array as parameter, 'Method2' has two int values as parameters.
  • redskry
    Options
    Oh great ! i undertsand !! Thanks a lot !! i really appreciate !!