The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Send multiple data via RPC to limit message on Photon Cloud

2017-06-06 23:13:20

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 ! :)


[Deleted User]
2017-06-08 07:45:22

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.

2017-06-08 09:38:48

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!

[Deleted User]
2017-06-08 09:46:06

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.

2017-06-08 09:48:11

Oh great ! i undertsand !! Thanks a lot !! i really appreciate !!

Back to top