I just have a few questions about these. I’ve tried searching Google, unity forums and unity answers for answers but none of them quite answer my questions the way I’m hoping for… I’ve even tried the IRC channel, lol.
I understand that a message relates only to the local client while an RPC has the same functionality only is able to work for multiple clients. With that in mind, am I mistaken in assuming that a message that manipulates a networkview-object will do the same as an RPC would? Or would I still need the RPC to manipulate the object on all clients?
I’m just a little confused about this aspect because reading the references and seeing examples doesn’t really give me a comparrison factor. So I’m just hoping a can find an answer here.
As an example to my question: say there is a networkview-object that has a function to delete itself, using network.destroy, when a player clicks on it. Would using a raycast function from the player to send a message to that object destroy it for all clients? or would it need to be an RPC?
RPCs are just networked function calls.
What they affect is completely up to the RPC, it can affect the whole client if you want it to do so.
It is basically nothing else but a “message that contains information on what to call and with what parameters”
For example login and logout would be this kind of “global functions”
synced network views could do that too, but there is one fundamental requirement on them and that is the constant length of buffers.
Also synced network views do so each time the network is meant to update and only then, while RPCs can be sent at any time
so it would be slightly advantageous to use RPCs versus just standard messages, even for simple things, when they involve an action pertaining to multiple clients then?
because, right now I have my project scripted with messages that manilpulate networkview objects, and I’m wondering if I’m going to need to rewrite anything…
There is no such thing as messages in unity network.
There is behaviour syncronization through OnSerializeNetworkView which is called X times per second and at fixed bitlengths if you want to use delta, not when you want it or at what sizes (ie data) you want it, and there is RPC. These are the only two mechanisms offered in unity
I understand that but my question is that if my client uses a message to move or interact with an object on my client and that object has networkview, will everyone else see what I did?
I have no problems with using rpc’s, I’m just curious as to whether they are necessary or not. Although from answers I’ve been getting, I can only gather that they are necessary.
ok, perfect. that’s the answer I was looking for. sorry if my question wasn’t specific enough in the beginning.
thanks guys, xD
If you’re not observing a specific component and using OnSerializeNetworkView() to specify what data you want the owner of that networkview to sync to the other clients, then yes, you need to use RPC’s.
sounds good, thanks again. xD