Hello everybody,
I am making a networked apps which allows me uploading some prefabs. Each prefab as a networked view and eachone is instantiated with Network.Instantiate(prefab,…, … , 0).
So if I have many clients connecting and connected, i can see the prefab allocated in all their view, but as soon as an object is moved, the view is changed only in the current view and not in all the clients’ ones.
Uhm, what am I missing?
Thanks.
GC
Are you syncing anything in the network view? Unless you want to sync the transform of the prefab to the other clients with RPC’s or a custom OnSerializeNetworkView, you need to drag the component you want to sync to the network view in the inspector (in your case, transform). But it’s probably going to be choppy.
Well, each of the prefab I have, has a NetworkView which observes the Transform of the object. I am trying to adapt the first 6 pages of this tutorial http://download.unity3d.com/support/resources/files/MultiplayerTutorial.pdf and I don’t see anything regarding RPC’s or OnSerializeNetworkView.
the only difference is that I use Network.Instantiate directly for the creation of the Prefab as a GameObject while in the tutorial they use a Spawn object and call the Network.Instantiate in the OnNetworkLoaded.
What do you mean with “are you syncing anything in the network view?”
Cheers.
GC
By sync I meant observing a component of the object, but as you said, you’re observing the object’s Transform. You don’t have state synchronization set to off, do you?
Seems strange, if your prefab is being successfully network.instantiated on all the clients and the prefab is syncing the transform, it should move for all connected players if it moves.
Hi, Yes, actually dunno why I changed my instatiate from:
Network.Instantiate(Resources.Load(s, GameObject), Vector3(0,0,0), Quaternion.identity,0);
to
object = Resources.Load(s,GameObject);
tobj = object.transform;
Network.Instantiate(Resources.Load(s, GameObject), tobj.position , tobj.rotation ,0);
and actually all the connected clients can see the objects moving. Now, dunno why, if a new client connects, I guess I have to call the Network.Instantiate to set his scene brand new… I think. My guess is to create and modify the OnNetworkConnected…
Well and the StateOfSynchronization is set to Reliable Delta Compressed.