HA! Thank you for this video, literally provided a perfect solution with zero issues. I was able to create a 4 directional top down multiplayer system using this. Thanks again!
This is the missing link! I have a procedurally generated suburb, and each house has a photon view because clients can interact with the doors (sync open/close door on the network). I would have over 1000+ photon views (one for each house), surpassing the MAX_VIEW_IDS. Thanks so much!
In a specific game I need to send the Position, Speed and Angular Speed of the objects. However, it can cause an overload causing constant photon disconnections. If I use ByteArraySlice can it resolve the disconnections?
Anyone know how to fix the CS0121 error I have for the RaiseEvent? The code is the exact same as in the video and in the documentation and I have the ExitGames.Client.Photon namespace.
at 7:40 when i copy this line 62, i get the error "error CS0103: The name 'RaiseEventOptions' does not exist in the current context". Does anyone know how to fix that?
Perfect tutorial! I loved your content, I'm having problems creating a laser, which all players have, I'm not able to activate a player's laser so that others can see. Either the player activates everyone's, or nothing happens. I'm very frustrated with this
I'm trying to flip the sprite of my weapon when it rotates below some angle. It works fine locally but how do I sync this on all clients. I've tried RPC and OnPhotonSerializeView but couldn't get it to work. Need help :(
Can you explain when to use RPC and raise event as if what makes them different apart from reliable and non reliable but which information should be sent through RPC and which through event
Rpcs are always reliable but not everything needs to be sent reliably. Sometimes you may want to send things like visual effects as non reliable which won't matter if they're dropped.
@FirstGearGames so as per my understanding if we have some effects like boom explosion or changing the flag color etc we can use events but if we want to send if the client shoot the gun or client died or spawn etc we can HAVE to use RPC
Does it work for movement?I have character that move ,and i applied this script to my character,and when masterclient moves,other client moves too,but it moves twitchy.
For me raise events or RPC both won't work properly on standalone builds and i have no freaking Idea why! I was suspicious as I was using only one photonView because i just want to transmit data and no move anyone. But, you did exactly what i wanted and it worked for you. The raise events work great when called from Unity editor but, won't work if called from standalone.
How can I do the same, but for everyone to be able change the color? Im making a card game an only the creator can move the cards :(, i don´t want that
its a great video really, but I have a certain doubt, why cant we use the raiseevent in the masterclient? I know its limited to that user who has the photonview ownership but the masterclient should also have one or... well, I think it has one
I've honestly never tried. You can have two players try to execute RPCs or sync variables at the same time without using IsMine checks. Results could be unpredictable. May be better to have another player request actions on the owning player rather than just trying to perform them.
I guess you forgot to mention that event won't wake inside the the script unless we call that manually on the sender. RPC can do that automatically, Correct me If I'm wrong
If you have a set of prefedined messages that do not change, you could send the id (int) of the message. If it is for chat, there is a Photon Chat asset for this on the store.
hi you have very good videos and im working in a game with them, thanks for all, i have a proble, if iuse "base.PhotonView.IsMine" i have errors wile im running the test, i've comented them, and is working, do you know why?
I have tried to send a raiseEvent to an object a to b, debug logged every incoming event on object b. So now when i start my game, the object b says that it receives events with code 253 (photon) but when mine (with code 0) is called, the object b doesnt say anything. As if the event gets lost. I know the reason can be anything but maybe it's already happened to you so... ^^ just trying
@@eiwangadoy6941 not likely it's getting lost unless your network is extremely unstable and you're sending unreliable. Send reliable to test and default options. If still no luck make sure you aren't using unsupported value/data types in your event.
@@FirstGearGames Well, i have fast internet and only sending a array of object with a single bool inside. But ima keep on digging and i'll share if I find anything, thanks for your tutorials :D
Well, according to a photon admin, raise events are only received by the other players in the room. I'm looking more deeply, i'll give a real answer later
For anyone who struggles : if (PhotonNetwork.IsMasterClient) { object[] data = new object[] { status }; RaiseEventOptions options = new RaiseEventOptions(); options.Receivers = ReceiverGroup.All; PhotonNetwork.RaiseEvent(0, data, options, SendOptions.SendReliable); Debug.Log("Sending event for activating cameras"); }
HA! Thank you for this video, literally provided a perfect solution with zero issues. I was able to create a 4 directional top down multiplayer system using this. Thanks again!
This is the missing link!
I have a procedurally generated suburb, and each house has a photon view because clients can interact with the doors (sync open/close door on the network).
I would have over 1000+ photon views (one for each house), surpassing the MAX_VIEW_IDS.
Thanks so much!
This method is the bomb , thanks for the code and explanations . Good luck
Brilliant explanations, thank you!!
In a specific game I need to send the Position, Speed and Angular Speed of the objects. However, it can cause an overload causing constant photon disconnections. If I use ByteArraySlice can it resolve the disconnections?
Anyone know how to fix the CS0121 error I have for the RaiseEvent? The code is the exact same as in the video and in the documentation and I have the ExitGames.Client.Photon namespace.
at 7:40 when i copy this line 62, i get the error "error CS0103: The name 'RaiseEventOptions' does not exist in the current context". Does anyone know how to fix that?
Right click on it press the lightbulb icon then it shows the necessary libraries you need to use
I'am getting this The type or namespace name 'EventData' could not be found (are you missing a using directive or an assembly reference?)
using ExitGames.Client.Photon;
use this namespace
i was having some trouble with the object array, if someone is having the same problem, try using a float array instead, it worked for me!
Perfect tutorial! I loved your content, I'm having problems creating a laser, which all players have, I'm not able to activate a player's laser so that others can see. Either the player activates everyone's, or nothing happens. I'm very frustrated with this
I'm trying to flip the sprite of my weapon when it rotates below some angle. It works fine locally but how do I sync this on all clients. I've tried RPC and OnPhotonSerializeView but couldn't get it to work. Need help :(
is there any way to convert those" object[] " definiton to custom classes like DataClass ?
Can you explain when to use RPC and raise event as if what makes them different apart from reliable and non reliable but which information should be sent through RPC and which through event
Rpcs are always reliable but not everything needs to be sent reliably. Sometimes you may want to send things like visual effects as non reliable which won't matter if they're dropped.
@FirstGearGames so as per my understanding if we have some effects like boom explosion or changing the flag color etc we can use events but if we want to send if the client shoot the gun or client died or spawn etc we can HAVE to use RPC
@@ashadodhiawala5039 you could run shooting as an event though but it may drop. Otherwise yes.
@@FirstGearGames Hi thanks for the tutorials.
What do you mean by "drop"?
I need to load a scene for all clients using Raise Event how could I do that
Would be great if you zoomed in. 125% zoom on the IDE makes it hard to see
This series has already been completed but I'll be sure to check my zoom levels in future videos. Thanks.
Agree!
Hello, when the photon room has no players, do the events still remain?
Does it work for movement?I have character that move ,and i applied this script to my character,and when masterclient moves,other client moves too,but it moves twitchy.
For me raise events or RPC both won't work properly on standalone builds and i have no freaking Idea why! I was suspicious as I was using only one photonView because i just want to transmit data and no move anyone. But, you did exactly what i wanted and it worked for you.
The raise events work great when called from Unity editor but, won't work if called from standalone.
How can I do the same, but for everyone to be able change the color?
Im making a card game an only the creator can move the cards :(, i don´t want that
its a great video really, but I have a certain doubt, why cant we use the raiseevent in the masterclient? I know its limited to that user who has the photonview ownership but the masterclient should also have one or... well, I think it has one
Thanks for this! Lifesaver!
Is it possible to make 2 player control the same object at the time ?
I've honestly never tried. You can have two players try to execute RPCs or sync variables at the same time without using IsMine checks. Results could be unpredictable. May be better to have another player request actions on the owning player rather than just trying to perform them.
I guess you forgot to mention that event won't wake inside the the script unless we call that manually on the sender. RPC can do that automatically, Correct me If I'm wrong
Im making a building system. What would be the best way to show the built object over the network so that all players see what has been built?
Probably RPC when the build starts. There's no reason build timers wouldn't line up; you can sync build percent if you were worried about it though.
Ok I’ll try that. Thanks
how could i change a text and send it to other users by using RaiseEvent? Text cannot be a Observed Component in Photon View.
If you have a set of prefedined messages that do not change, you could send the id (int) of the message. If it is for chat, there is a Photon Chat asset for this on the store.
hi you have very good videos and im working in a game with them, thanks for all, i have a proble, if iuse "base.PhotonView.IsMine" i have errors wile im running the test, i've comented them, and is working, do you know why?
Great job man thanks, but can you please tell me how can i make this for RawImage
If you are trying to send an image you probably want to use a third party server for that. You can try a byte array if it's small.
I have tried to send a raiseEvent to an object a to b, debug logged every incoming event on object b. So now when i start my game, the object b says that it receives events with code 253 (photon) but when mine (with code 0) is called, the object b doesnt say anything. As if the event gets lost. I know the reason can be anything but maybe it's already happened to you so... ^^ just trying
Update : I debug logged the raise event and it returned true so... getting lost?
@@eiwangadoy6941 not likely it's getting lost unless your network is extremely unstable and you're sending unreliable. Send reliable to test and default options. If still no luck make sure you aren't using unsupported value/data types in your event.
@@FirstGearGames Well, i have fast internet and only sending a array of object with a single bool inside. But ima keep on digging and i'll share if I find anything, thanks for your tutorials :D
Well, according to a photon admin, raise events are only received by the other players in the room. I'm looking more deeply, i'll give a real answer later
For anyone who struggles :
if (PhotonNetwork.IsMasterClient)
{
object[] data = new object[] { status };
RaiseEventOptions options = new RaiseEventOptions();
options.Receivers = ReceiverGroup.All;
PhotonNetwork.RaiseEvent(0, data, options, SendOptions.SendReliable);
Debug.Log("Sending event for activating cameras");
}
Unity won't recognize EventData