Hi, My first thread. I started to make my game become multiplayer today.

Hi everyone. I made a singleplayer game and now I decided to make it multiplayer. (And the singleplayer part will be still available. I don’t wanna get rid of it.)

But I got some questions here.

  1. Every prefab has to be added with the NetworkView component. So here I got 2 choices: 1) Create all prefabs specifically for the multiplayer part with the NetworkView components, which means I’ll have 2 sets of prefabs, one for singleplayer and one for multiplayer. They’ll be exactly the same except that the multiplayer prefabs have the NetworkView components. 2) Both singleplayer and multiplayer use the same prefab with NetworkView components. Of course the singleplayer part woundn’t actually use this component. 3) And there might be the 3rd choice, but it seems that it doesn’t work, that is, Instantiate the prefab and then AddComponent(“NetworkView”).

So which choice might be my best choice in this case?

2.In the official manual, I’m sure everyone here should be quite familiar with this. When loading a level, there’s some javascript scripts like:
Network.SetSendingEnabled(0, false);
Network.isMessageQueueRunning = false;
Network.SetLevelPrefix(levelPrefix);
Application.LoadLevel(level);
yield;
yield;
Network.isMessageQueueRunning = true;
Network.SetSendingEnabled(0, true);

My question is, in the “yield; yield;”, how to write it in C#? Or, Can I write it like:

Network.SetSendingEnabled(0, false);
Network.isMessageQueueRunning = false;
Network.SetLevelPrefix(levelPrefix);
Application.LoadLevel(level); //Here I delete the rest of the script and add the OnLevelWasLoaded function here.
void OnLevelWasLoaded(int levelIndex)
{
if (levelIndex == 1)
{
Network.isMessageQueueRunning = true;
Network.SetSendingEnabled(0, true);
}
}

Thank you very much!!

Hi!
I’m trying to do the same, adapting the code here http://unity3d.com/support/documentation/Components/net-NetworkLevelLoad.html to C#.
Could anyone help me? Thanks!