// Use this for initialization void Start() { if (!created) { // this is the first instance - make it persist DontDestroyOnLoad(this.gameObject); created = true; } else { // this must be a duplicate from a scene reload - DESTROY! Destroy(this.gameObject); } broadcastSever = this.GetComponent<LANBroadcastService> (); for (int i = 0; i < lengthOfPassword; i++) { number = Random.Range (0, 9); password += number.ToString (); } LaunchServer (password); }
void Awake() { foundLANGames = new List<FoundGame>(); lanBroadcastService = gameObject.GetComponent<LANBroadcastService>(); // Start looking for hosts on the LAN Debug.Log("Polling for LAN games on port " + ConfigurationDirector.GetMulticastPort()); }