problem with lan multiplayer game in unity

I’m trying to Learn how to make offline Lan multiplayer Game in Unity.

so for example I make something that can send text message and make cube xD

now this is my problem:

(when i send message,try connect to server,create cube i should first click on an other window!!!)

startserver:

    using UnityEngine;
using System.Collections;

public class StartServer : MonoBehaviour {
	public Transform Taghsimobj;
	public Transform Makan;
	public Transform CubeOBJ;

	public string MSG; 
	public string ResMsg;

	void Ress (string inres) {
		ResMsg = inres;
		
	}

	void OnGUI () {

		if (Network.peerType == NetworkPeerType.Disconnected)
		{
			if (GUILayout.Button ("StartServer"))
			{
				Network.InitializeServer(10, 25000);
			}
			if (GUILayout.Button ("Connect"))
			{
				Network.Connect ("192.168.1.101", 25000);
			}

		} 
		else 
		{
			if (GUILayout.Button ("CreatCube"))
			{
				Network.Instantiate (CubeOBJ, Makan.transform.position, Makan.transform.rotation, 0);
			}
			if (GUILayout.Button ("CreatChat"))
			{
				Network.Instantiate (Taghsimobj, this.transform.position, this.transform.rotation, 0);
			}
			if (GUILayout.Button ("SendMessage"))
			{
				GameObject.Find ("GameObject(Clone)").GetComponent<NetworkView>().RPC ("ResText", RPCMode.All, MSG);
			}
			MSG=GUILayout.TextField(MSG);	
			GUILayout.Box (ResMsg);
		}
			
	
	}
}

taghsim:

    using UnityEngine;
using System.Collections;

public class Taghsim : MonoBehaviour {

	void Start () {
	}
	
	[RPC]
	void ResText (string ResIn) {
		GameObject.Find ("Main Camera").SendMessage ("Ress", ResIn);
	
	}
}

sorry for my bad english

I don’t think the actual code is the problem. When your game loses focus, in this case switching to the other window, your game becomes paused. You can disable this feature by going into the Player settings (Edit->Project Settings->Player) and check Run in background (under Resolution and Presentation)