Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.Networking;
- using UnityEngine.Networking.Types;
- using UnityEngine.Networking.Match;
- using UnityEngine.UI;
- using System.Collections;
- public class CreateServer : MonoBehaviour {
- public InputField ServerName;
- public InputField MaxPlayers;
- [HideInInspector]
- public string ErrorDialog;
- [HideInInspector]
- public bool connectFailed = false;
- public static readonly string SceneNameGame = "Test Scene";
- public void CreateAServer() {
- //Setup the server's variables
- int PCount = int.Parse(MaxPlayers.text);
- CreateMatchRequest create = new CreateMatchRequest();
- create.name = ServerName.text;
- create.size = (uint)int.Parse(MaxPlayers.text);
- create.advertise = true;
- create.password = "";
- //Start the match
- ENetManager.Current.matchMaker.CreateMatch(create, ENetManager.Current.OnMatchCreate);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement