Photon Pun Sharing Arrays of Bytes! I'm stuck
The whole answer can be found below.
Try Our
Documentation
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.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Photon Pun Sharing Arrays of Bytes! I'm stuck
reddote
2021-12-20 12:42:25
I have a problem with sharing data with photon. In my code, Master client is adding png files and converting them to sprites. other users should get sprites through to photon but since Photon doesnt send sprites in RPC I'm trying to sending Texture2D data then I will turn them into texture. But I'm stuck since RPC doesnt send my files and this is my guess. I sent raw byte data 2 but it didnt work either.
This is png file uploader
this is UIController object's script
Sorry for my bad english I hope I was able to explain myself. You can see scripts in the attachments. Scripts a liitle bit messy mostly I'm fixing when code works so sorry for that.
Uploaded 2021-12-20T12:42:21+00:00 2463 bytes
Comments
The Photon servers are not exactly built to send images around. You usually want to do this via a CDN. Someone loads the image up, gets and ID and that ID can be shared within Photon Rooms.
If you absolutely must send images, make sure you compress them and turn them to byte[], which can be sent "as is". You can send a byte[] as parameter of an RPC and or via RaiseEvent.
Ty for your advices the problem was byte limit for rpc, my images larger than 512kb so I tried smaller images and it did worked. My most images are coming from local PC I will search CDN probably the best solution for that, on the other hand some of my images are generated so I wil try to compress or chunk for these images because they need to be under 512kb for RPC.
Back to topTobias 2021-12-21T13:16:19+00:00
The Photon servers are not exactly built to send images around. You usually want to do this via a CDN. Someone loads the image up, gets and ID and that ID can be shared within Photon Rooms.
If you absolutely must send images, make sure you compress them and turn them to byte[], which can be sent "as is". You can send a byte[] as parameter of an RPC and or via RaiseEvent.