x


Are all game objects Network.Instantiated on level load?

So here is my question:

I have a level whith multiple GameObjects each oh which has NetworkView attached. When I do RPC call to load the level for several players will all these NetworkViewed objects be in sync?

I mean whether Network.Instantiate is used to instantiate game objects whith NetworkView attached when level loads???

more ▼

asked Oct 26 '10 at 07:52 AM

Anton Petrov gravatar image

Anton Petrov
447 10 11 23

I'm having a similar issue. When my client connects, I want it to load all currently instantiated objects on the server side. For this I am trying to use the code here: http://unity3d.com/support/documentation/Components/net-NetworkLevelLoad.html

However, the client is not loading any objects that have been Network.Instantiate()d before my client connected.

Thanks,

May 19 '12 at 11:00 PM Swift_On_Fire
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

No. Only if you use Network.Instantiate the objects will know that they are the same instance and sync state.

more ▼

answered Oct 26 '10 at 08:19 AM

StephanK gravatar image

StephanK
6k 40 53 93

So it looks like I have to instantiate all interactive objects (like power-ups, enemies etc.) manualy for multiplayer game, right?

Oct 26 '10 at 08:26 AM Anton Petrov

@spree-1: That's not true! GameObjects with NetworkViews that are part of a scene have their ViewIDs serialized along with the scene. If two clients load the same scene they are automatically in synch.

I never use Network.Instantiate because you have almost no control over the deletion of the objects.

Scene NetworkViewIDs have it's own id range so they don't interfere with dynamically created IDs. However they can interfere with other scene IDs, but that's no problem as long as all clients use the same scene. If you load a new scene at runtime you can and should use SetLevelPrefix to prefix all scene NetworkViewIDs.

May 20 '12 at 12:20 AM Bunny83
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x731
x725

asked: Oct 26 '10 at 07:52 AM

Seen: 1935 times

Last Updated: May 20 '12 at 12:20 AM