Does anyone have a fully working networking script?

I pulled this from a cgcookie post:

//NetworkManagerScript

using UnityEngine;
using System.Collections;

public class NetworkManagerScript : MonoBehaviour{

public Transform spawnObject;
public GameObject playerPrefab;

private string currentMenu;

private float bttnW = 150;
private float bttnH = 40;

private bool Refreshing = false;
private HostData[] hostData;

private string gameName = "Medieval_Swords_Online";

void Start()
{
    currentMenu = "Multiplayer";
}

void Update()
{
    if (Refreshing)
    {
        if (MasterServer.PollHostList().Length > 0)
        {
            Debug.Log(MasterServer.PollHostList().Length.ToString());
            Refreshing = false;
            hostData = MasterServer.PollHostList();
        }
    }
}

//Own Functions
void startServer()
{
    //initialize the server
    Network.InitializeServer(32, 25001, !Network.HavePublicAddress());
    MasterServer.RegisterHost(gameName, "Medieval Swords Online", "This is a beginners game");
}

void RefreshHostList()
{
    MasterServer.RequestHostList(gameName);
    Refreshing = true;

}

void spawnPlayer()
{
    Network.Instantiate(playerPrefab, spawnObject.position, Quaternion.identity, 0);
}

//Unity Server Events
void OnServerInitialized()
{
    //event when the server is initialized
    Debug.Log("Server Initialized!");
    spawnPlayer();
}

void OnMasterServerEvent(MasterServerEvent mse)
{
    if(mse == MasterServerEvent.RegistrationSucceeded)
    {
        Debug.Log("Registered Server");
    }
}

void OnConnectedToServer()
{
    spawnPlayer();
}


//Gui
void OnGUI()
{
    if (currentMenu == "Main")
        Menu_Main();

    if (currentMenu == "Multiplayer")
        Menu_Multiplayer();

}

void Menu_Main()
{

}

void Menu_Multiplayer()
{
    if (!Network.isClient && !Network.isServer)
    {
        if (GUI.Button(new Rect(50, 50, bttnW, bttnH), "Start Server"))
        {
            startServer();
        }

        if (GUI.Button(new Rect(50, 100, bttnW, bttnH), "Refresh"))
        {
            Debug.Log("Refreshing...");
            RefreshHostList();
        }

        GUILayout.BeginArea(new Rect(Screen.width - 500, 0, 500, Screen.height), "Server List");
        GUILayout.Space(20);
        foreach (HostData hostedGame in MasterServer.PollHostList())
        {
            GUILayout.BeginHorizontal("Box");

            GUILayout.Label(hostedGame.gameName);
            if (GUILayout.Button("Connect"))
            {
                Network.Connect(hostedGame);
            }

            GUILayout.EndHorizontal();
        }

        GUILayout.EndArea();
    }
}

}

//MovementScript

using UnityEngine; using System.Collections;

public class MovementScript : MonoBehaviour {

int speed = 5;
int gravity = 5;
private CharacterController cc = new CharacterController();
void Start(){
	cc=GetComponent(CharacterController);
}
void Update(){
	if(GetComponent<NetworkView>().isMine()){
		cc.Move(Vector3(Input.GetAxis("Horizontal") * speed * Time.deltaTime, -gravity * Time.deltaTime, Input.GetAxis("Vertical") 
		                * speed * Time.deltaTime));
	}
	else{
		enabled = false;
	}
}

}

//SphereScript with RPCCalls

using UnityEngine;
using System.Collections;

public class SphereScript : MonoBehaviour {

//trigger script

[RPC]
void OnTriggerEnter(){
	Debug.Log("Hello");
	Vector3 newCol = new Vector3(1,0,0);
	GetComponent<NetworkView>().RPC("SetColor", RPCMode.AllBuffered, newCol);
}

void setColor(Vector3 newColor){
	GetComponent<Renderer>().material.color = Color(newColor.x, newColor.y, newColor.z, 1);
}

}

There are lots of errors, I’m not sure why. The only error where I can tell what is wrong is in the SphereScript, which says that UnityEngine.RPC is obsolete, refer to Multiplayer Networking System. Can anyone help?

Simply connecting to a network won’t automagically make all your objects become synchronised across every client - you have to program the logic to do that… if it’s something as simple as a single transform, you can add that to the watched component of the NetworkView attached to the object, but as soon you require something more complicated you’ll need to use RPC calls or OnSerializeNetwork. It’s all in the manual: http://docs.unity3d.com/Manual/NetworkReferenceGuide.html

Also, note that as of Unity 5.1 the old RakNet Network class has been depreciated in favour of UNet, so if you’re only just starting learning networking now, you might want to move straight to the new system: Unity - Manual: Multiplayer and Networking