Help for LAN multiplayer in C# ?

Hey guys

I’m almost finished my new game, and the only thing left to implement is the LAN multiplayer. I’ve found loads of great tutorials on this for JavaScript, but some of my game, such as the play button and player, use prefabricated C# code. I was wondering if anyone with some experience in this could please help me with this? I need to have the game finished by tomorrow, so a quick answer would be really appreciated :slight_smile: Here’s the code for the start button for some reference:

using UnityEngine;
using System.Collections;

public class PlayButton : MonoBehaviour {

	private bool _run = false;
	private PlayerControl _playerControl;
	
	void Start(){
		_playerControl = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerControl>();
	}
	
	void OnGUI () {
	    if (_run == false && GUI.Button (new Rect (Screen.width/2-125,Screen.height/2-35,250,70), "Play")) {
			_playerControl.status = true;
	        _run = true;
	    }else if (_run == true && GUI.Button (new Rect (10,10,100,50), "Stop")) {
			_playerControl.status = false;
	        _run = false;
	    }

	}
	
} 

Thanks

Harry

Have you consider reviewing this area of the documentation?

http://docs.unity3d.com/Documentation/Components/NetworkReferenceGuide.html

It has a great walkthrough of all the concepts of basic client/server relationships in Unity. Unity also provides some nice classes (The Network class) in C# to get a basic LAN system going, where one of the game instances is considered the “server” and the others connect to it. You might have to reorganize some code, because implementing these things can change some of the decisions you make in places.

M2H also has a great reference on this, and some example projects. They used to be on the asset store, but Im not sure if they still are. You can google M2H Networking Tutorial to find them.