- Home /
Networkview sync variables two-way?
Hi,
I have a script, which is observed by a network view, and in the script I have a OnSerializeNetworkView method:
void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
{
stream.Serialize(ref _WantedDirection);
}
So I want my wantedDirection to be synced to everybody. Though everybody should also be able to change it. Though apparently the network view only pushes the changes to the other people, if someone else changes it, it only changes for him.
So, is there any way to make the networkview sync both ways? Not just from the owner to everyone else?
Thanks!
Answer by ScroodgeM · Jul 28, 2012 at 01:38 PM
simpliest way to achieve this is two instantiate object by server, and send from all users to server their control comands using RPC method. then apply all controls on server to object, and object will be synchronized to all users.
http://docs.unity3d.com/Documentation/ScriptReference/NetworkView.RPC.html
you can'w make two-way sync using only networkView component
Alright thanks, was hoping it was possible with only the NetworkView. Now I know this isn't possible, thanks!
Your answer
Follow this Question
Related Questions
Since switching to using offline & online scenes in the NetworkManager, Clients will not sync (UNET) 0 Answers
How do I send a simple Vector3 over a network? 1 Answer
Transform network views and dead reckoning 1 Answer
Connect to non-unity server with LLAPI 0 Answers
Networking RPC sends to wrong target 0 Answers