Created
January 2, 2016 16:44
-
-
Save hecomi/c25739785102932c457d to your computer and use it in GitHub Desktop.
NetworkOperation.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.Networking; | |
using System.Collections; | |
public class NetworkOperations : MonoBehaviour | |
{ | |
private NetworkManager manager_; | |
private bool isBatchmode_ = false; | |
public string address = "lab.hecomi.com"; | |
public int port = 30001; | |
public bool isEmulationServer = false; | |
public bool isHost = false; | |
void Start() | |
{ | |
manager_ = GetComponent<NetworkManager>(); | |
manager_.networkAddress = address; | |
manager_.networkPort = port; | |
manager_.maxConnections = 200; | |
isBatchmode_ = (SystemInfo.graphicsDeviceID == 0); | |
if (isHost) { | |
manager_.StartHost(); | |
} else if (isBatchmode_ || isEmulationServer) { | |
Application.targetFrameRate = 30; | |
manager_.StartServer(); | |
} | |
} | |
public void StartClient() | |
{ | |
manager_.StartClient(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment